diff options
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 22 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider_gtk.cc | 24 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider_win.cc | 25 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.cc | 7 |
4 files changed, 22 insertions, 56 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index c271ba9..a3c2c09 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -2788,3 +2788,25 @@ RenderViewHost* AutomationProvider::GetViewForTab(int tab_handle) { return NULL; } + +void AutomationProvider::GetBrowserForWindow(int window_handle, + bool* success, + int* browser_handle) { + *success = false; + *browser_handle = 0; + + gfx::NativeWindow window = window_tracker_->GetResource(window_handle); + if (!window) + return; + + BrowserList::const_iterator iter = BrowserList::begin(); + for (;iter != BrowserList::end(); ++iter) { + gfx::NativeWindow this_window = (*iter)->window()->GetNativeHandle(); + if (window == this_window) { + // Add() returns the existing handle for the resource if any. + *browser_handle = browser_tracker_->Add(*iter); + *success = true; + return; + } + } +} diff --git a/chrome/browser/automation/automation_provider_gtk.cc b/chrome/browser/automation/automation_provider_gtk.cc index 6bdc484..eb86492 100644 --- a/chrome/browser/automation/automation_provider_gtk.cc +++ b/chrome/browser/automation/automation_provider_gtk.cc @@ -69,30 +69,6 @@ void AutomationProvider::GetFocusedViewID(int handle, int* view_id) { NOTIMPLEMENTED(); } -void AutomationProvider::GetBrowserForWindow(int window_handle, - bool* success, - int* browser_handle) { - *success = false; - *browser_handle = 0; - -#if !defined(TOOLKIT_VIEWS) - GtkWindow* window = window_tracker_->GetResource(window_handle); - if (!window) - return; - - BrowserWindowGtk* browser_window = - BrowserWindowGtk::GetBrowserWindowForNativeWindow(window); - if (!browser_window) - return; - - Browser* browser = browser_window->browser(); - if (browser) { - *browser_handle = browser_tracker_->Add(browser); - *success = true; - } -#endif // !defined(TOOLKIT_VIEWS) -} - void AutomationProvider::PrintAsync(int tab_handle) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index 3319ea5..cbc0452 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -328,31 +328,6 @@ void AutomationProvider::GetTabHWND(int handle, HWND* tab_hwnd) { } } -void AutomationProvider::GetBrowserForWindow(int window_handle, - bool* success, - int* browser_handle) { - *success = false; - *browser_handle = 0; - - if (window_tracker_->ContainsHandle(window_handle)) { - HWND window = window_tracker_->GetResource(window_handle); - BrowserList::const_iterator iter = BrowserList::begin(); - Browser* browser = NULL; - for (;iter != BrowserList::end(); ++iter) { - HWND hwnd = reinterpret_cast<HWND>((*iter)->window()->GetNativeHandle()); - if (window == hwnd) { - browser = *iter; - break; - } - } - if (browser) { - // Add() returns the existing handle for the resource if any. - *browser_handle = browser_tracker_->Add(browser); - *success = true; - } - } -} - void AutomationProvider::CreateExternalTab( const IPC::ExternalTabSettings& settings, gfx::NativeWindow* tab_container_window, gfx::NativeWindow* tab_window, diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc index 46a7a46..162a6ab 100644 --- a/chrome/common/temp_scaffolding_stubs.cc +++ b/chrome/common/temp_scaffolding_stubs.cc @@ -108,13 +108,6 @@ void AutomationProvider::GetFocusedViewID(int handle, int* view_id) { NOTIMPLEMENTED(); } -void AutomationProvider::GetBrowserForWindow(int window_handle, - bool* success, - int* browser_handle) { - *success = false; - NOTIMPLEMENTED(); -} - void AutomationProvider::PrintAsync(int tab_handle) { NOTIMPLEMENTED(); } |