コード例 #1
0
ファイル: Xpcom.cs プロジェクト: Joker0727/WebBrowserFirefox
        private static void OnProfileStartup()
        {
            if (!EnableProfileMonitoring)
            {
                return;
            }

            nsIObserver addonsIntegration = null;

            nsIObserverService obsSvc = Xpcom.GetService <nsIObserverService>(Contracts.ObserverService);

            obsSvc.NotifyObservers(null, "profile-do-change", "startup");
            try
            {
                addonsIntegration = Xpcom.GetService <nsIObserver>("@mozilla.org/addons/integration;1");
                if (addonsIntegration != null)
                {
                    addonsIntegration.Observe(null, "addons-startup", null);
                }

                obsSvc.NotifyObservers(null, "load-extension-defaults", null);
            }
            finally
            {
                Xpcom.FreeComObject(ref addonsIntegration);

                obsSvc.NotifyObservers(null, "profile-after-change", "startup");
                NS_CreateServicesFromCategory("profile-after-change", null, "profile-after-change");
                obsSvc.NotifyObservers(null, "profile-initial-state", null);
                Xpcom.FreeComObject(ref obsSvc);
            }
        }
コード例 #2
0
ファイル: nsIObserver.cs プロジェクト: nlhepler/mono
		public static nsIObserver GetProxy (Mono.WebBrowser.IWebBrowser control, nsIObserver obj)
		{
			object o = Base.GetProxyForObject (control, typeof(nsIObserver).GUID, obj);
			return o as nsIObserver;
		}
コード例 #3
0
 public void ShowPageSetup(nsIDOMWindow parent, nsIPrintSettings printSettings, nsIObserver aObs)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
 public void ShowProgress(nsIDOMWindow parent, nsIWebBrowserPrint webBrowserPrint, nsIPrintSettings printSettings, nsIObserver openDialogObserver, bool isForPrinting, ref nsIWebProgressListener webProgressListener, ref nsIPrintProgressParams printProgressParams, ref bool notifyOnOpen)
 {
     throw new NotImplementedException();
 }
コード例 #5
0
		public static void RemoveObserver(nsIObserver observer, string topic)
		{
			_observerService.Instance.RemoveObserver(observer, topic);
		}
コード例 #6
0
		public static void AddObserver(nsIObserver observer, string topic, bool ownsWeak)
		{
			_observerService.Instance.AddObserver(observer, topic, ownsWeak);
		}
コード例 #7
0
ファイル: ObserverService.cs プロジェクト: loundar/geckofx-29
 public static void RemoveObserver(nsIObserver observer, string topic)
 {
     _observerService.Instance.RemoveObserver(observer, topic);
 }
コード例 #8
0
ファイル: ObserverService.cs プロジェクト: loundar/geckofx-29
 public static void AddObserver(nsIObserver observer, string topic, bool ownsWeak)
 {
     _observerService.Instance.AddObserver(observer, topic, ownsWeak);
 }
コード例 #9
0
ファイル: Xpcom.cs プロジェクト: Joker0727/WebBrowserFirefox
        private static void NS_CreateServicesFromCategory(string category, nsISupports origin, string observerTopic)
        {
            nsICategoryManager      catMan      = null;
            nsISimpleEnumerator     enumerator  = null;
            nsIUTF8StringEnumerator senumerator = null;

            try
            {
                catMan = Xpcom.GetService <nsICategoryManager>(Contracts.CategoryManager);
                if (catMan == null)
                {
                    return;
                }

                enumerator = catMan.EnumerateCategory(category);
                if (enumerator == null)
                {
                    return;
                }

                senumerator = Xpcom.QueryInterface <nsIUTF8StringEnumerator>(enumerator);
                if (senumerator == null)
                {
                    return;
                }

                while (senumerator.HasMore())
                {
                    nsISupports serviceInstance = null;
                    nsIObserver observer        = null;
                    try
                    {
                        string entryString = nsString.Get(senumerator.GetNext);
                        string contractID  = catMan.GetCategoryEntry(category, entryString);
                        serviceInstance = Xpcom.GetService <nsISupports>(contractID);
                        if (serviceInstance == null || observerTopic == null)
                        {
                            continue;
                        }

                        observer = Xpcom.QueryInterface <nsIObserver>(serviceInstance);
                        if (observer == null)
                        {
                            continue;
                        }

                        observer.Observe(origin, observerTopic, "");
                    }
                    catch (NotImplementedException) { }
                    catch (OutOfMemoryException) { }
                    catch (COMException) { }
                    finally
                    {
                        Xpcom.FreeComObject(ref serviceInstance);
                        Xpcom.FreeComObject(ref observer);
                    }
                }
            }
            finally
            {
                Xpcom.FreeComObject(ref catMan);
                Xpcom.FreeComObject(ref enumerator);
                Xpcom.FreeComObject(ref senumerator);
            }
        }
コード例 #10
0
        public static nsIObserver GetProxy(Mono.WebBrowser.IWebBrowser control, nsIObserver obj)
        {
            object o = Base.GetProxyForObject(control, typeof(nsIObserver).GUID, obj);

            return(o as nsIObserver);
        }