diff options
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 3 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider_mac.mm | 3 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider_win.cc | 5 | ||||
-rw-r--r-- | chrome/browser/external_tab_container.cc | 5 | ||||
-rw-r--r-- | chrome/browser/external_tab_container.h | 2 | ||||
-rw-r--r-- | chrome/test/automation/automation_messages_internal.h | 5 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 5 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.h | 5 | ||||
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 2 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_plugin.h | 9 |
11 files changed, 30 insertions, 17 deletions
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 0c30ced..6329a3a 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -439,7 +439,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, const MSG& msg); #endif - void SetInitialFocus(const IPC::Message& message, int handle, bool reverse); + void SetInitialFocus(const IPC::Message& message, int handle, bool reverse, + bool restore_focus_to_view); // See comment in AutomationMsg_WaitForTabToBeRestored. void WaitForTabToBeRestored(int tab_handle, IPC::Message* reply_message); diff --git a/chrome/browser/automation/automation_provider_gtk.cc b/chrome/browser/automation/automation_provider_gtk.cc index 62b378f..a0fe498 100644 --- a/chrome/browser/automation/automation_provider_gtk.cc +++ b/chrome/browser/automation/automation_provider_gtk.cc @@ -84,7 +84,8 @@ void AutomationProvider::PrintAsync(int tab_handle) { } void AutomationProvider::SetInitialFocus(const IPC::Message& message, - int handle, bool reverse) { + int handle, bool reverse, + bool restore_focus_to_view) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/automation/automation_provider_mac.mm b/chrome/browser/automation/automation_provider_mac.mm index 9f2ed97..ff92977 100644 --- a/chrome/browser/automation/automation_provider_mac.mm +++ b/chrome/browser/automation/automation_provider_mac.mm @@ -78,7 +78,8 @@ void AutomationProvider::OnMessageFromExternalHost(int handle, } void AutomationProvider::SetInitialFocus(const IPC::Message& message, - int handle, bool reverse) { + int handle, bool reverse, + bool restore_focus_to_view) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index d86e0b5..2be9574 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -347,10 +347,11 @@ void AutomationProvider::ProcessUnhandledAccelerator( } void AutomationProvider::SetInitialFocus(const IPC::Message& message, - int handle, bool reverse) { + int handle, bool reverse, + bool restore_focus_to_view) { ExternalTabContainer* external_tab = GetExternalTabForHandle(handle); if (external_tab) { - external_tab->FocusThroughTabTraversal(reverse); + external_tab->FocusThroughTabTraversal(reverse, restore_focus_to_view); } // This message expects no response. } diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index 4c46493..42db662 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -237,7 +237,8 @@ void ExternalTabContainer::ProcessUnhandledAccelerator(const MSG& msg) { GetFocusManager()); } -void ExternalTabContainer::FocusThroughTabTraversal(bool reverse) { +void ExternalTabContainer::FocusThroughTabTraversal( + bool reverse, bool restore_focus_to_view) { DCHECK(tab_contents_); if (tab_contents_) tab_contents_->Focus(); @@ -246,7 +247,7 @@ void ExternalTabContainer::FocusThroughTabTraversal(bool reverse) { // TabContentsViewWin::Focus() above. This method eventually calls SetFocus // on the native window, which could end up dispatching messages like // WM_DESTROY for the external tab. - if (tab_contents_) + if (tab_contents_ && restore_focus_to_view) tab_contents_->FocusThroughTabTraversal(reverse); } diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h index dcf30ee..eca66b1 100644 --- a/chrome/browser/external_tab_container.h +++ b/chrome/browser/external_tab_container.h @@ -86,7 +86,7 @@ class ExternalTabContainer : public TabContentsDelegate, void ProcessUnhandledAccelerator(const MSG& msg); // See TabContents::FocusThroughTabTraversal. Called from AutomationProvider. - void FocusThroughTabTraversal(bool reverse); + void FocusThroughTabTraversal(bool reverse, bool restore_focus_to_view); // A helper method that tests whether the given window is an // ExternalTabContainer window diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index 8430172..d938b9f 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -551,9 +551,12 @@ IPC_BEGIN_MESSAGES(Automation) // - bool: |reverse| // true: Focus will be set to the last focusable element // false: Focus will be set to the first focusable element + // - bool: |restore_focus_to_view| + // true: The renderer view associated with the current tab will be + // infomed that it is receiving focus. // Response: // None expected - IPC_MESSAGE_ROUTED2(AutomationMsg_SetInitialFocus, int, bool) + IPC_MESSAGE_ROUTED3(AutomationMsg_SetInitialFocus, int, bool, bool) // This message is an outgoing message from Chrome to an external host. // It is a request to open a url diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index ed4db9e..495cf7a 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -522,11 +522,12 @@ bool TabProxy::ProcessUnhandledAccelerator(const MSG& msg) { } #endif // defined(OS_WIN) -bool TabProxy::SetInitialFocus(bool reverse) { +bool TabProxy::SetInitialFocus(bool reverse, bool restore_focus_to_view) { if (!is_valid()) return false; return sender_->Send( - new AutomationMsg_SetInitialFocus(0, handle_, reverse)); + new AutomationMsg_SetInitialFocus(0, handle_, reverse, + restore_focus_to_view)); // This message expects no response } diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index 8115871..ad28090 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -286,7 +286,10 @@ class TabProxy : public AutomationResourceProxy, #endif // defined(OS_WIN) // Ask the tab to set focus to either the first or last element on the page. - bool SetInitialFocus(bool reverse) WARN_UNUSED_RESULT; + // When the restore_focus_to_view parameter is true, the render view + // associated with the current tab is informed that it is receiving focus. + bool SetInitialFocus(bool reverse, bool restore_focus_to_view) + WARN_UNUSED_RESULT; // Waits for the tab to finish being restored. Returns true on success. // timeout_ms gives the max amount of time to wait for restore to complete. diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index 26bfa4f..d31b2a8 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -194,7 +194,7 @@ STDMETHODIMP ChromeActiveDocument::IsDirty() { void ChromeActiveDocument::OnAutomationServerReady() { BaseActiveX::OnAutomationServerReady(); - BaseActiveX::GiveFocusToChrome(); + BaseActiveX::GiveFocusToChrome(true); } STDMETHODIMP ChromeActiveDocument::Load(BOOL fully_avalable, diff --git a/chrome_frame/chrome_frame_plugin.h b/chrome_frame/chrome_frame_plugin.h index c7b0598..85d83dc 100644 --- a/chrome_frame/chrome_frame_plugin.h +++ b/chrome_frame/chrome_frame_plugin.h @@ -142,7 +142,7 @@ END_MSG_MAP() UINT selected = TrackPopupMenuEx(copy, flags, params.screen_x, params.screen_y, GetWindow(), NULL); // Menu is over now give focus back to chrome - GiveFocusToChrome(); + GiveFocusToChrome(false); if (IsValid() && selected != 0 && !self->HandleContextMenuCommand(selected, params)) { automation_client_->SendContextMenuCommandToChromeFrame(selected); @@ -155,7 +155,7 @@ END_MSG_MAP() LRESULT OnSetFocus(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { // NO_LINT if (!ignore_setfocus_ && IsValid()) { - GiveFocusToChrome(); + GiveFocusToChrome(true); } return 0; } @@ -215,13 +215,14 @@ END_MSG_MAP() return new ChromeFrameAutomationClient; } - void GiveFocusToChrome() { + void GiveFocusToChrome(bool restore_focus_to_view) { if (IsValid()) { TabProxy* tab = automation_client_->tab(); HWND chrome_window = automation_client_->tab_window(); if (tab && ::IsWindow(chrome_window)) { DLOG(INFO) << "Setting initial focus"; - tab->SetInitialFocus(win_util::IsShiftPressed()); + tab->SetInitialFocus(win_util::IsShiftPressed(), + restore_focus_to_view); } } } |