summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc17
-rw-r--r--chrome/browser/automation/testing_automation_provider.h4
2 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index b3da96a..e49b401 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -398,6 +398,8 @@ bool TestingAutomationProvider::OnMessageReceived(
IPC_MESSAGE_HANDLER_DELAY_REPLY(
AutomationMsg_WaitForProcessLauncherThreadToGoIdle,
WaitForProcessLauncherThreadToGoIdle)
+ IPC_MESSAGE_HANDLER(AutomationMsg_GetParentBrowserOfTab,
+ GetParentBrowserOfTab)
IPC_MESSAGE_UNHANDLED(
handled = AutomationProvider::OnMessageReceived(message))
@@ -4618,6 +4620,21 @@ void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle(
new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message);
}
+void TestingAutomationProvider::GetParentBrowserOfTab(int tab_handle,
+ int* browser_handle,
+ bool* success) {
+ *success = false;
+ if (tab_tracker_->ContainsHandle(tab_handle)) {
+ NavigationController* controller = tab_tracker_->GetResource(tab_handle);
+ int index;
+ Browser* browser = Browser::GetBrowserForController(controller, &index);
+ if (browser) {
+ *browser_handle = browser_tracker_->Add(browser);
+ *success = true;
+ }
+ }
+}
+
// TODO(brettw) change this to accept GURLs when history supports it
void TestingAutomationProvider::OnRedirectQueryComplete(
HistoryService::Handle request_handle,
diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h
index bd42171..43cfaaf 100644
--- a/chrome/browser/automation/testing_automation_provider.h
+++ b/chrome/browser/automation/testing_automation_provider.h
@@ -800,6 +800,10 @@ class TestingAutomationProvider : public AutomationProvider,
void WaitForProcessLauncherThreadToGoIdle(IPC::Message* reply_message);
+ // Gets the browser that contains the given tab.
+ void GetParentBrowserOfTab(
+ int tab_handle, int* browser_handle, bool* success);
+
// Callback for history redirect queries.
virtual void OnRedirectQueryComplete(
HistoryService::Handle request_handle,