diff options
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 10 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 3 | ||||
-rw-r--r-- | chrome/browser/external_tab_container.cc | 12 | ||||
-rw-r--r-- | chrome/browser/external_tab_container.h | 4 | ||||
-rw-r--r-- | chrome/test/automation/automation_messages_internal.h | 16 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.cc | 12 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.h | 3 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.cc | 2 |
8 files changed, 44 insertions, 18 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index fe947c5..0b52891 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -2051,17 +2051,23 @@ void AutomationProvider::CloseBrowser(const IPC::Message& message, } } -void AutomationProvider::CreateExternalTab(const IPC::Message& message) { +void AutomationProvider::CreateExternalTab(const IPC::Message& message, + HWND parent, + const gfx::Rect& dimensions, + unsigned int style) { int tab_handle = 0; HWND tab_container_window = NULL; ExternalTabContainer *external_tab_container = new ExternalTabContainer(this); - external_tab_container->Init(profile_); + external_tab_container->Init(profile_, parent, dimensions, style); TabContents* tab_contents = external_tab_container->tab_contents(); if (tab_contents) { tab_handle = tab_tracker_->Add(tab_contents->controller()); tab_container_window = *external_tab_container; + } else { + delete external_tab_container; } + Send(new AutomationMsg_CreateExternalTabResponse(message.routing_id(), tab_container_window, tab_handle)); diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 0022369..841bfce 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -237,7 +237,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, const std::string& html_text); void HideInterstitialPage(const IPC::Message& message, int tab_handle); - void CreateExternalTab(const IPC::Message& message); + void CreateExternalTab(const IPC::Message& message, HWND parent, + const gfx::Rect& dimensions, unsigned int style); void NavigateInExternalTab(const IPC::Message& message, int handle, const GURL& url); // The container of an externally hosted tab calls this to reflect any diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index 3d89034..565221d 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -35,13 +35,15 @@ ExternalTabContainer::ExternalTabContainer( ExternalTabContainer::~ExternalTabContainer() { } -bool ExternalTabContainer::Init(Profile* profile) { +bool ExternalTabContainer::Init(Profile* profile, HWND parent, + const gfx::Rect& dimensions, + unsigned int style) { if (IsWindow()) { NOTREACHED(); return false; } // First create the container window - if (!Create(NULL)) { + if (!Create(NULL, dimensions.ToRECT())) { NOTREACHED(); return false; } @@ -87,6 +89,12 @@ bool ExternalTabContainer::Init(Profile* profile) { Notify(NOTIFY_EXTERNAL_TAB_CREATED, Source<NavigationController>(controller), NotificationService::NoDetails()); + + // Now apply the parenting and style + if (parent) + SetParent(parent); + ModifyStyle(0, style, 0); + ::ShowWindow(tab_contents_->GetContainerHWND(), SW_SHOW); return true; } diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h index b335f13..9e631e4 100644 --- a/chrome/browser/external_tab_container.h +++ b/chrome/browser/external_tab_container.h @@ -51,7 +51,9 @@ class ExternalTabContainer : public TabContentsDelegate, return tab_contents_; } - bool Init(Profile* profile); + bool Init(Profile* profile, HWND parent, const gfx::Rect& dimensions, + unsigned int style); + // Overridden from TabContentsDelegate: virtual void OpenURLFromTab(TabContents* source, const GURL& url, diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index 8005606..a22818c 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -442,11 +442,17 @@ IPC_BEGIN_MESSAGES(Automation, 0) // TODO(port): Port these messages. // // This message notifies the AutomationProvider to create a tab which is - // hosted by an external process. The response contains the HWND of the - // window that contains the external tab and the handle to the newly - // created tab - // The second parameter is the url to be loaded in the new tab. - IPC_MESSAGE_ROUTED0(AutomationMsg_CreateExternalTab) + // hosted by an external process. + // Request: + // HWND - handle to a window acting as a parent/owner for the new tab. + // gfx::Rect - initial dimensions. + // style - window style to be used at the time of cration. + IPC_MESSAGE_ROUTED3(AutomationMsg_CreateExternalTab, + HWND /* owner_or_parent*/, + gfx::Rect /* dimensions */, + unsigned int /* style */) + // The response contains the HWND of the window that contains the external + // tab and the handle to the newly created tab. IPC_MESSAGE_ROUTED2(AutomationMsg_CreateExternalTabResponse, HWND, int) #endif // defined(OS_WIN) diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index 9f3c886..73ae223 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -345,8 +345,7 @@ bool AutomationProxy::ClickAppModalDialogButton( bool is_timeout = true; if (!SendAndWaitForResponseWithTimeout( new AutomationMsg_ClickAppModalDialogButtonRequest(0, button), - &response, - AutomationMsg_ClickAppModalDialogButtonResponse::ID, + &response, AutomationMsg_ClickAppModalDialogButtonResponse::ID, command_execution_timeout_ms_, &is_timeout)) { return false; } @@ -531,11 +530,14 @@ bool AutomationProxy::OpenNewBrowserWindow(int show_command) { return Send(new AutomationMsg_OpenNewBrowserWindow(0, show_command)); } -TabProxy* AutomationProxy::CreateExternalTab(HWND* external_tab_container) { +TabProxy* AutomationProxy::CreateExternalTab(HWND parent, + const gfx::Rect& dimensions, + unsigned int style, + HWND* external_tab_container) { IPC::Message* response = NULL; bool succeeded = SendAndWaitForResponse( - new AutomationMsg_CreateExternalTab(0), &response, - AutomationMsg_CreateExternalTabResponse::ID); + new AutomationMsg_CreateExternalTab(0, parent, dimensions, style), + &response, AutomationMsg_CreateExternalTabResponse::ID); if (!succeeded) { return NULL; } diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index e388333..dc53672 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -186,7 +186,8 @@ class AutomationProxy : public IPC::Channel::Listener, // Creates a tab that can hosted in an external process. The function // returns a TabProxy representing the tab as well as a window handle // that can be reparented in another process. - TabProxy* CreateExternalTab(HWND* external_tab_container); + TabProxy* CreateExternalTab(HWND parent, const gfx::Rect& dimensions, + unsigned int style, HWND* external_tab_container); int command_execution_timeout_ms() const { return command_execution_timeout_ms_; diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index bc109885..212100a 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -749,7 +749,7 @@ bool ExternalTabHandler(HWND external_tab_window) { TEST_F(AutomationProxyVisibleTest, CreateExternalTab) { HWND external_tab_container = NULL; scoped_ptr<TabProxy> tab(automation()->CreateExternalTab( - &external_tab_container)); + NULL, gfx::Rect(), 0, &external_tab_container)); EXPECT_TRUE(tab != NULL); EXPECT_NE(FALSE, ::IsWindow(external_tab_container)); if (tab != NULL) { |