summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation/automation_provider.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/automation/automation_provider.cc')
-rw-r--r--chrome/browser/automation/automation_provider.cc22
1 files changed, 22 insertions, 0 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;
+ }
+ }
+}