diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 22:32:04 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 22:32:04 +0000 |
commit | 675595f2f4c6856cdc5190a01056e5aaeb77808f (patch) | |
tree | 889a976ebfa6089479f4869ea3b738344f5da551 /chrome | |
parent | 1c6c2fe3c88098d58f725ea1aa6f9a82dd66cae9 (diff) | |
download | chromium_src-675595f2f4c6856cdc5190a01056e5aaeb77808f.zip chromium_src-675595f2f4c6856cdc5190a01056e5aaeb77808f.tar.gz chromium_src-675595f2f4c6856cdc5190a01056e5aaeb77808f.tar.bz2 |
AutomationProvider: Implement GetBrowserForWindow() on mac and linux views.
Review URL: http://codereview.chromium.org/174505
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24547 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-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(); } |