Index: chrome/test/automation/tab_proxy.cc |
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc |
index e04c039ba13fb10c8c826665b785068e11e3aa0c..1b413334fd8121979cc6c8141091287b2cc563e7 100644 |
--- a/chrome/test/automation/tab_proxy.cc |
+++ b/chrome/test/automation/tab_proxy.cc |
@@ -13,6 +13,7 @@ |
#include "chrome/common/automation_messages.h" |
#include "chrome/common/json_value_serializer.h" |
#include "chrome/test/automation/automation_proxy.h" |
+#include "chrome/test/automation/browser_proxy.h" |
#include "googleurl/src/gurl.h" |
TabProxy::TabProxy(AutomationMessageSender* sender, |
@@ -21,6 +22,29 @@ TabProxy::TabProxy(AutomationMessageSender* sender, |
: AutomationResourceProxy(tracker, sender, handle) { |
} |
+scoped_refptr<BrowserProxy> TabProxy::GetParentBrowser() const { |
+ if (!is_valid()) |
+ return NULL; |
+ |
+ int browser_handle = 0; |
+ bool success = false; |
+ sender_->Send(new AutomationMsg_GetParentBrowserOfTab( |
+ handle_, &browser_handle, &success)); |
+ if (!success) |
+ return NULL; |
+ |
+ BrowserProxy* browser = static_cast<BrowserProxy*>( |
+ tracker_->GetResource(browser_handle)); |
+ if (!browser) { |
+ browser = new BrowserProxy(sender_, tracker_, browser_handle); |
+ browser->AddRef(); |
+ } |
+ |
+ // Since there is no scoped_refptr::attach. |
+ scoped_refptr<BrowserProxy> result; |
+ result.swap(&browser); |
+ return result; |
+} |
bool TabProxy::GetTabTitle(std::wstring* title) const { |
if (!is_valid()) |