/// <summary> /// /// </summary> public override void Terminate() { GlobalWindowManager.WindowAdded -= GlobalWindowManager_WindowAdded; AutoType.SequenceQuery -= AutoType_SequenceQuery; AutoType.SequenceQueriesBegin -= AutoType_SequenceQueriesBegin; AutoType.SequenceQueriesEnd -= AutoType_SequenceQueriesEnd; // Edit form customisations will be removed automatically when the form is closed. if (mOptionsMenu != null) { m_host.MainWindow.ToolsMenu.DropDownItems.Remove(mOptionsMenu); mOptionsMenu = null; } if (mCreateEntryHotkeyId != 0) { var result = HotKeyManager.UnregisterHotKey(mCreateEntryHotkeyId); Debug.Assert(result); mCreateEntryHotkeyId = 0; } if (mChromeAccessibility != null) { mChromeAccessibility.Dispose(); mChromeAccessibility = null; } }
/// <summary> /// Gets the URL from the browser with the current focus. If there is no current focus, falls back on trying to get the active URL from /// the fallback top-level window handle specified. /// /// If the current focus is detected to be in a password field, passwordFieldFocussed is set true. /// </summary> internal static string GetFocusedBrowserUrl(ChromeAccessibilityWinEventHook chromeAccessibility, IntPtr hwnd, out bool passwordFieldFocussed) { var browserUrlReader = BrowserUrlReader.Create(hwnd); if (browserUrlReader is ChromeBrowserUrlReader) { ((ChromeBrowserUrlReader)browserUrlReader).ChromeAccessibilityWinEventHook = chromeAccessibility; } return(browserUrlReader.GetBrowserFocusUrl(out passwordFieldFocussed)); }
internal static void GetFocusedBrowserInfo(ChromeAccessibilityWinEventHook chromeAccessibility, out string selectedText, out string url, out string title) { var browserUrlReader = BrowserUrlReader.Create(GetForegroundWindow()); if (browserUrlReader is ChromeBrowserUrlReader) { ((ChromeBrowserUrlReader)browserUrlReader).ChromeAccessibilityWinEventHook = chromeAccessibility; } if (browserUrlReader == null) { selectedText = null; url = null; title = null; } else { url = browserUrlReader.GetBrowserFocusUrlWithInfo(out title, out selectedText); } }
public override bool Initialize(IPluginHost host) { Debug.Assert(host != null); if (host == null) { return(false); } m_host = host; GlobalWindowManager.WindowAdded += GlobalWindowManager_WindowAdded; AutoType.SequenceQuery += AutoType_SequenceQuery; AutoType.SequenceQueriesBegin += AutoType_SequenceQueriesBegin; AutoType.SequenceQueriesEnd += AutoType_SequenceQueriesEnd; mOptionsMenu = new ToolStripMenuItem { Text = Properties.Resources.OptionsMenuItemText, }; mOptionsMenu.Click += mOptionsMenu_Click; m_host.MainWindow.ToolsMenu.DropDownItems.Add(mOptionsMenu); IpcUtilEx.IpcEvent += OnIpcEvent; HotKeyManager.HotKeyPressed += HotKeyManager_HotKeyPressed; if (CreateEntryHotKey != Keys.None) { mCreateEntryHotkeyId = HotKeyManager.RegisterHotKey(CreateEntryHotKey); } mSearchTextBoxField = typeof(SearchForm).GetField("m_tbSearch", BindingFlags.Instance | BindingFlags.NonPublic); mChromeAccessibility = new ChromeAccessibilityWinEventHook(); return(true); // Initialization successful }