summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-11 18:22:19 +0000
committerstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-11 18:22:19 +0000
commitc4e944f68c080d06737f15ecb60fa69caf001275 (patch)
treeb10cb8b19f79b8c8d3d308e2ad083dae6fb27a92
parent197ea64be37bf1aeadde177a9e2d8bedcab8775c (diff)
downloadchromium_src-c4e944f68c080d06737f15ecb60fa69caf001275.zip
chromium_src-c4e944f68c080d06737f15ecb60fa69caf001275.tar.gz
chromium_src-c4e944f68c080d06737f15ecb60fa69caf001275.tar.bz2
Get tab HWND directly as result of CreateExternalTab automation call.
BUG=none TEST=none Review URL: http://codereview.chromium.org/119448 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18181 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xchrome/browser/automation/automation_provider.cc3
-rw-r--r--chrome/browser/automation/automation_provider.h4
-rw-r--r--chrome/browser/extensions/extension_uitest.cc5
-rw-r--r--chrome/common/ipc_message_macros.h19
-rwxr-xr-xchrome/test/automation/automation_messages_internal.h5
-rw-r--r--chrome/test/automation/automation_proxy.cc3
-rw-r--r--chrome/test/automation/automation_proxy.h2
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc12
8 files changed, 42 insertions, 11 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index dcb6afe..5b692b8 100755
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -2440,9 +2440,11 @@ void AutomationProvider::CreateExternalTab(HWND parent,
unsigned int style,
bool incognito,
HWND* tab_container_window,
+ HWND* tab_window,
int* tab_handle) {
*tab_handle = 0;
*tab_container_window = NULL;
+ *tab_window = NULL;
ExternalTabContainer *external_tab_container =
new ExternalTabContainer(this);
Profile* profile = incognito? profile_->GetOffTheRecordProfile() : profile_;
@@ -2452,6 +2454,7 @@ void AutomationProvider::CreateExternalTab(HWND parent,
*tab_handle = tab_tracker_->Add(&tab_contents->controller());
external_tab_container->set_tab_handle(*tab_handle);
*tab_container_window = external_tab_container->GetNativeView();
+ *tab_window = tab_contents->GetNativeView();
} else {
delete external_tab_container;
}
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 174faff..3dedd65 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -301,7 +301,9 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
#if defined(OS_WIN)
void CreateExternalTab(HWND parent, const gfx::Rect& dimensions,
unsigned int style, bool incognito,
- HWND* tab_container_window, int* tab_handle);
+ HWND* tab_container_window,
+ HWND* tab_window,
+ int* tab_handle);
#endif // defined(OS_WIN)
void NavigateInExternalTab(
diff --git a/chrome/browser/extensions/extension_uitest.cc b/chrome/browser/extensions/extension_uitest.cc
index 102bbac..38a5bb6 100644
--- a/chrome/browser/extensions/extension_uitest.cc
+++ b/chrome/browser/extensions/extension_uitest.cc
@@ -52,8 +52,9 @@ class ExtensionUITest : public ParentTestType {
void TestWithURL(const GURL& url) {
HWND external_tab_container = NULL;
- scoped_refptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(),
- WS_POPUP, false, &external_tab_container));
+ HWND tab_wnd = NULL;
+ scoped_refptr<TabProxy> tab(automation()->CreateExternalTab(NULL,
+ gfx::Rect(), WS_POPUP, false, &external_tab_container, &tab_wnd));
ASSERT_TRUE(tab != NULL);
ASSERT_NE(FALSE, ::IsWindow(external_tab_container));
DoAdditionalPreNavigateSetup(tab.get());
diff --git a/chrome/common/ipc_message_macros.h b/chrome/common/ipc_message_macros.h
index cd5a988..11e5258 100644
--- a/chrome/common/ipc_message_macros.h
+++ b/chrome/common/ipc_message_macros.h
@@ -133,6 +133,7 @@
#undef IPC_SYNC_MESSAGE_ROUTED4_0
#undef IPC_SYNC_MESSAGE_ROUTED4_1
#undef IPC_SYNC_MESSAGE_ROUTED4_2
+#undef IPC_SYNC_MESSAGE_ROUTED4_3
#if defined(IPC_MESSAGE_MACROS_ENUMS)
#undef IPC_MESSAGE_MACROS_ENUMS
@@ -302,6 +303,9 @@
#define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \
msg_class##__ID,
+#define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \
+ msg_class##__ID,
+
// Message crackers and handlers.
// Prefer to use the IPC_BEGIN_MESSAGE_MAP_EX to the older macros since they
// allow you to detect when a message could not be de-serialized. Usage:
@@ -572,6 +576,9 @@ LogFunction g_log_function_mapping[LastMsgIndex];
#define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \
IPC_MESSAGE_LOG(msg_class)
+#define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \
+ IPC_MESSAGE_LOG(msg_class)
+
#elif defined(IPC_MESSAGE_MACROS_CLASSES)
#undef IPC_MESSAGE_MACROS_CLASSES
@@ -1150,4 +1157,16 @@ LogFunction g_log_function_mapping[LastMsgIndex];
MakeRefTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg5, *arg6)) {} \
};
+#define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \
+ class msg_class : \
+ public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \
+ Tuple3<type1_out&, type2_out&, type3_out&> > { \
+ public: \
+ enum { ID = msg_class##__ID }; \
+ msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6, type3_out* arg7) \
+ : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \
+ Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \
+ MakeRefTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg5, *arg6, *arg7)) {} \
+ };
+
#endif // #if defined()
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 7682807..d746202 100755
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -426,12 +426,13 @@ IPC_BEGIN_MESSAGES(Automation)
// gfx::Rect - initial dimensions.
// style - window style to be used at the time of cration.
// incognito - use off-the-record profile
- IPC_SYNC_MESSAGE_ROUTED4_2(AutomationMsg_CreateExternalTab,
+ IPC_SYNC_MESSAGE_ROUTED4_3(AutomationMsg_CreateExternalTab,
HWND /* owner_or_parent*/,
gfx::Rect /* dimensions */,
unsigned int /* style */,
bool /* off-the-record profile */,
- HWND /* The window handle is returned here */,
+ HWND, // Tab container HWND
+ HWND, // Tab HWND
int /* Handle to the new tab */)
#endif // defined(OS_WIN)
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index e54f6a6..27f1701d 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -486,7 +486,7 @@ bool AutomationProxy::OpenNewBrowserWindow(bool show) {
// TODO(port): Replace HWNDs.
scoped_refptr<TabProxy> AutomationProxy::CreateExternalTab(HWND parent,
const gfx::Rect& dimensions, unsigned int style, bool incognito,
- HWND* external_tab_container) {
+ HWND* external_tab_container, HWND* tab) {
IPC::Message* response = NULL;
int handle = 0;
@@ -494,6 +494,7 @@ scoped_refptr<TabProxy> AutomationProxy::CreateExternalTab(HWND parent,
Send(new AutomationMsg_CreateExternalTab(0, parent, dimensions, style,
incognito,
external_tab_container,
+ tab,
&handle));
if (!succeeded) {
return NULL;
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index b1cec94..11bf615 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -194,7 +194,7 @@ class AutomationProxy : public IPC::Channel::Listener,
// that can be reparented in another process.
scoped_refptr<TabProxy> CreateExternalTab(HWND parent,
const gfx::Rect& dimensions, unsigned int style, bool incognito,
- HWND* external_tab_container);
+ HWND* external_tab_container, HWND* tab);
#endif // defined(OS_WIN)
int command_execution_timeout_ms() const {
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index bb838dd..c6c71c8 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -759,8 +759,9 @@ void AutomationProxyForExternalTab::OnForwardMessageToExternalHost(
TEST_F(ExternalTabTestType, CreateExternalTab) {
HWND external_tab_container = NULL;
+ HWND tab_wnd = NULL;
scoped_refptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(),
- WS_POPUP, false, &external_tab_container));
+ WS_POPUP, false, &external_tab_container, &tab_wnd));
EXPECT_TRUE(tab != NULL);
EXPECT_NE(FALSE, ::IsWindow(external_tab_container));
if (tab != NULL) {
@@ -774,12 +775,13 @@ TEST_F(ExternalTabTestType, CreateExternalTab) {
TEST_F(ExternalTabTestType, IncognitoMode) {
HWND external_tab_container = NULL;
+ HWND tab_wnd = NULL;
GURL url("http://anatomyofmelancholy.net");
std::string value_result;
// Create incognito tab
scoped_refptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(),
- WS_POPUP, true, &external_tab_container));
+ WS_POPUP, true, &external_tab_container, &tab_wnd));
EXPECT_TRUE(tab->SetCookie(url, "robert=burton; "
"expires=Thu, 13 Oct 2011 05:04:03 UTC;"));
EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result));
@@ -790,9 +792,10 @@ TEST_F(ExternalTabTestType, IncognitoMode) {
value_result.empty();
clear_profile_ = false;
external_tab_container = NULL;
+ tab_wnd = NULL;
LaunchBrowserAndServer();
tab = automation()->CreateExternalTab(NULL, gfx::Rect(),
- WS_POPUP, false, &external_tab_container);
+ WS_POPUP, false, &external_tab_container, &tab_wnd);
EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result));
EXPECT_EQ("", value_result);
}
@@ -802,8 +805,9 @@ TEST_F(ExternalTabTestType, ExternalTabPostMessage) {
static_cast<AutomationProxyForExternalTab*>(automation());
HWND external_tab_container = NULL;
+ HWND tab_wnd = NULL;
scoped_refptr<TabProxy> tab(proxy->CreateExternalTab(NULL, gfx::Rect(),
- WS_POPUP, false, &external_tab_container));
+ WS_POPUP, false, &external_tab_container, &tab_wnd));
EXPECT_TRUE(tab != NULL);
EXPECT_NE(FALSE, ::IsWindow(external_tab_container));
if (tab != NULL) {