diff options
author | joshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-28 21:50:39 +0000 |
---|---|---|
committer | joshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-28 21:50:39 +0000 |
commit | 31fb110528230784dc006c182edfa1003a2b9be8 (patch) | |
tree | 1643403af67a179f2439ca565f203f5a2c780872 /chrome/browser | |
parent | 875ac10e1efb37bff2182aa82e4da47830c09a6b (diff) | |
download | chromium_src-31fb110528230784dc006c182edfa1003a2b9be8.zip chromium_src-31fb110528230784dc006c182edfa1003a2b9be8.tar.gz chromium_src-31fb110528230784dc006c182edfa1003a2b9be8.tar.bz2 |
Better control over window creation of external tabs
Improving automation interface to offer better control over
window creation of external tabs. The changes allow us
to specify a parent window, initial size and window style.
Review URL: http://codereview.chromium.org/19048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8828 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-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 |
4 files changed, 23 insertions, 6 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, |