summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-23 22:15:34 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-23 22:15:34 +0000
commitf5494d49ab74e3d116540b14db3457558f54c88e (patch)
treebeb367c01c187652d02091a5067a69d5bc0fa064 /chrome_frame
parenta9f39a313b7ecc11d98727d869e15094481f3a65 (diff)
downloadchromium_src-f5494d49ab74e3d116540b14db3457558f54c88e.zip
chromium_src-f5494d49ab74e3d116540b14db3457558f54c88e.tar.gz
chromium_src-f5494d49ab74e3d116540b14db3457558f54c88e.tar.bz2
Clean up Automation and Chrome Frame IPC code.-only use routed messages when needed-use routing IDs to avoid manually unpacking messages-remove data structures from IPC namespace (that should only be used for IPC code, and param traits)Note that I temporarily commented out part of a test in external_tab_test.cc because I couldn't figure out how to get the updated gmock macros to compile.
Review URL: http://codereview.chromium.org/5998006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70105 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/cfproxy.h60
-rw-r--r--chrome_frame/cfproxy_private.h5
-rw-r--r--chrome_frame/cfproxy_proxy.cc33
-rw-r--r--chrome_frame/cfproxy_support.cc227
-rw-r--r--chrome_frame/cfproxy_test.cc188
-rw-r--r--chrome_frame/chrome_active_document.cc42
-rw-r--r--chrome_frame/chrome_active_document.h34
-rw-r--r--chrome_frame/chrome_frame_activex.cc7
-rw-r--r--chrome_frame/chrome_frame_activex.h5
-rw-r--r--chrome_frame/chrome_frame_activex_base.h25
-rw-r--r--chrome_frame/chrome_frame_automation.cc55
-rw-r--r--chrome_frame/chrome_frame_delegate.cc9
-rw-r--r--chrome_frame/chrome_frame_delegate.h61
-rw-r--r--chrome_frame/chrome_frame_npapi.cc6
-rw-r--r--chrome_frame/chrome_frame_npapi.h5
-rw-r--r--chrome_frame/chrome_frame_plugin.h9
-rw-r--r--chrome_frame/external_tab.cc107
-rw-r--r--chrome_frame/external_tab.h74
-rw-r--r--chrome_frame/external_tab_test.cc67
-rw-r--r--chrome_frame/npapi_url_request.cc2
-rw-r--r--chrome_frame/npapi_url_request.h3
-rw-r--r--chrome_frame/plugin_url_request.h19
-rw-r--r--chrome_frame/test/automation_client_mock.cc20
-rw-r--r--chrome_frame/test/automation_client_mock.h38
-rw-r--r--chrome_frame/test/chrome_frame_automation_mock.h21
-rw-r--r--chrome_frame/test/url_request_test.cc12
-rw-r--r--chrome_frame/urlmon_url_request.cc2
-rw-r--r--chrome_frame/urlmon_url_request.h2
28 files changed, 336 insertions, 802 deletions
diff --git a/chrome_frame/cfproxy.h b/chrome_frame/cfproxy.h
index c3acf7a..ae404b2 100644
--- a/chrome_frame/cfproxy.h
+++ b/chrome_frame/cfproxy.h
@@ -15,6 +15,7 @@
#include "base/file_path.h"
#include "chrome/common/automation_constants.h"
#include "chrome/common/page_zoom.h"
+#include "ipc/ipc_channel.h"
enum FindInPageDirection { BACK = 0, FWD = 1 };
enum FindInPageCase { IGNORE_CASE = 0, CASE_SENSITIVE = 1 };
@@ -28,18 +29,15 @@ enum AutomationPageFontSize {
LARGEST_FONT = 36
};
-class URLRequestStatus;
-namespace IPC {
- struct ExternalTabSettings;
- struct NavigationInfo;
- struct AutomationURLRequest;
- struct AttachExternalTabParams;
- struct MiniContextMenuParams;
-};
-
-class GURL;
-class ChromeProxyFactory;
class ChromeProxyDelegate;
+class ChromeProxyFactory;
+class GURL;
+class URLRequestStatus;
+struct AttachExternalTabParams;
+struct AutomationURLRequest;
+struct ExternalTabSettings;
+struct MiniContextMenuParams;
+struct NavigationInfo;
struct ProxyParams;
// Some callers of synchronous messages wants a context to be passed back
@@ -89,7 +87,7 @@ class ChromeProxy {
// Tab management.
virtual void CreateTab(ChromeProxyDelegate* delegate,
- const IPC::ExternalTabSettings& settings) = 0;
+ const ExternalTabSettings& settings) = 0;
virtual void ConnectTab(ChromeProxyDelegate* delegate, HWND hwnd,
uint64 cookie) = 0;
virtual void BlockTab(uint64 cookie) = 0;
@@ -142,7 +140,7 @@ class ChromeProxy {
// instance of Chromium.
// Allow only one delegate per tab, i.e. delegate can handle only a single tab.
// Note: all of the methods are invoked always in a background IPC thread.
-class ChromeProxyDelegate {
+class ChromeProxyDelegate : public IPC::Channel::Listener {
public:
enum DisconnectReason {
CHROME_EXE_LAUNCH_FAILED,
@@ -150,6 +148,9 @@ class ChromeProxyDelegate {
CHANNEL_ERROR
};
+ // IPC::Channel::Listener.
+ void OnMessageReceived(const IPC::Message& message) = 0;
+
virtual void Connected(ChromeProxy* proxy) = 0;
virtual void Disconnected() = 0;
virtual void PeerLost(ChromeProxy* proxy, DisconnectReason reason) = 0;
@@ -169,39 +170,6 @@ class ChromeProxyDelegate {
virtual void Completed_GetEnabledExtensions(bool success,
const std::vector<FilePath>* extensions) = 0;
- // Network requests from Chrome.
- virtual void Network_Start(int request_id,
- const IPC::AutomationURLRequest& request_info) = 0;
- virtual void Network_Read(int request_id, int bytes_to_read) = 0;
- virtual void Network_End(int request_id, const URLRequestStatus& status) = 0;
- virtual void Network_DownloadInHost(int request_id) = 0;
- virtual void GetCookies(const GURL& url, int cookie_id) = 0;
- virtual void SetCookie(const GURL& url, const std::string& cookie) = 0;
-
- // Navigation progress notifications.
- virtual void NavigationStateChanged(int flags,
- const IPC::NavigationInfo& nav_info) = 0;
- virtual void UpdateTargetUrl(const std::wstring& url) = 0;
- virtual void NavigationFailed(int error_code, const GURL& gurl) = 0;
- virtual void DidNavigate(const IPC::NavigationInfo& navigation_info) = 0;
- virtual void TabLoaded(const GURL& url) = 0;
-
- // Navigation and messaging.
- virtual void OpenURL(const GURL& url_to_open, const GURL& referrer,
- int open_disposition) = 0;
- virtual void GoToHistoryOffset(int offset) = 0;
- virtual void MessageToHost(const std::string& message,
- const std::string& origin,
- const std::string& target) = 0;
- // Misc. UI.
- virtual void HandleAccelerator(const MSG& accel_message) = 0;
- virtual void HandleContextMenu(HANDLE menu_handle, int align_flags,
- const IPC::MiniContextMenuParams& params) = 0;
- virtual void TabbedOut(bool reverse) = 0;
-
- // Tab related.
- virtual void TabClosed() = 0;
- virtual void AttachTab(const IPC::AttachExternalTabParams& attach_params) = 0;
protected:
~ChromeProxyDelegate() {}
};
diff --git a/chrome_frame/cfproxy_private.h b/chrome_frame/cfproxy_private.h
index a9cc6dc..6ec0080 100644
--- a/chrome_frame/cfproxy_private.h
+++ b/chrome_frame/cfproxy_private.h
@@ -155,7 +155,7 @@ class CFProxy : public Interface2IPCMessage,
virtual void Tab_OverrideEncoding(int tab, const char* encoding);
virtual void Tab_Navigate(int tab, const GURL& url, const GURL& referrer);
virtual void CreateTab(ChromeProxyDelegate* delegate,
- const IPC::ExternalTabSettings& p);
+ const ExternalTabSettings& p);
virtual void ConnectTab(ChromeProxyDelegate* delegate, HWND hwnd,
uint64 cookie);
virtual void BlockTab(uint64 cookie);
@@ -183,9 +183,6 @@ DISABLE_RUNNABLE_METHOD_REFCOUNT(CFProxy);
// Support functions.
std::string GenerateChannelId();
-int IsTabMessage(const IPC::Message& message);
-bool DispatchTabMessageToDelegate(ChromeProxyDelegate* delegate,
- const IPC::Message& m);
std::wstring BuildCmdLine(const std::string& channel_id,
const FilePath& profile_path,
const std::wstring& extra_args);
diff --git a/chrome_frame/cfproxy_proxy.cc b/chrome_frame/cfproxy_proxy.cc
index 7dcb944..0f59d8a 100644
--- a/chrome_frame/cfproxy_proxy.cc
+++ b/chrome_frame/cfproxy_proxy.cc
@@ -128,21 +128,21 @@ void CFProxy::SendIpcMessageOnIoThread(IPC::Message* m) {
void CFProxy::InstallExtension(ChromeProxyDelegate* delegate,
const FilePath& crx_path,
SyncMessageContext* ctx) {
- IPC::SyncMessage* m = new AutomationMsg_InstallExtension(0, crx_path, NULL);
+ IPC::SyncMessage* m = new AutomationMsg_InstallExtension(crx_path, NULL);
sync_dispatcher_.QueueSyncMessage(m, delegate, ctx);
SendIpcMessage(m);
}
void CFProxy::LoadExtension(ChromeProxyDelegate* delegate,
const FilePath& path, SyncMessageContext* ctx) {
- IPC::SyncMessage* m = new AutomationMsg_LoadExpandedExtension(0, path, 0);
+ IPC::SyncMessage* m = new AutomationMsg_LoadExpandedExtension(path, 0);
sync_dispatcher_.QueueSyncMessage(m, delegate, ctx);
SendIpcMessage(m);
}
void CFProxy::GetEnabledExtensions(ChromeProxyDelegate* delegate,
SyncMessageContext* ctx) {
- IPC::SyncMessage* m = new AutomationMsg_GetEnabledExtensions(0, NULL);
+ IPC::SyncMessage* m = new AutomationMsg_GetEnabledExtensions(NULL);
sync_dispatcher_.QueueSyncMessage(m, delegate, ctx);
SendIpcMessage(m);
}
@@ -156,22 +156,21 @@ void CFProxy::Tab_Find(int tab, const string16& search_string,
params.find_next = find_next;
params.match_case = (match_case == CASE_SENSITIVE);
params.forward = (forward == FWD);
- IPC::SyncMessage* m = new AutomationMsg_Find(0, tab, params, NULL, NULL);
+ IPC::SyncMessage* m = new AutomationMsg_Find(tab, params, NULL, NULL);
// Not interested in result.
sync_dispatcher_.QueueSyncMessage(m, NULL, NULL);
SendIpcMessage(m);
}
void CFProxy::Tab_OverrideEncoding(int tab, const char* encoding) {
- IPC::SyncMessage* m = new AutomationMsg_OverrideEncoding(0, tab, encoding,
- NULL);
+ IPC::SyncMessage* m = new AutomationMsg_OverrideEncoding(tab, encoding, NULL);
// Not interested in result.
sync_dispatcher_.QueueSyncMessage(m, NULL, NULL);
SendIpcMessage(m);
}
void CFProxy::Tab_Navigate(int tab, const GURL& url, const GURL& referrer) {
- IPC::SyncMessage* m = new AutomationMsg_NavigateInExternalTab(0,
+ IPC::SyncMessage* m = new AutomationMsg_NavigateInExternalTab(
tab, url, referrer, NULL);
// We probably are not interested in result since provider just checks
// whether tab handle is valid.
@@ -180,29 +179,29 @@ void CFProxy::Tab_Navigate(int tab, const GURL& url, const GURL& referrer) {
}
void CFProxy::CreateTab(ChromeProxyDelegate* delegate,
- const IPC::ExternalTabSettings& p) {
- IPC::SyncMessage* m = new AutomationMsg_CreateExternalTab(0, p, 0, 0, 0, 0);
+ const ExternalTabSettings& p) {
+ IPC::SyncMessage* m = new AutomationMsg_CreateExternalTab(p, 0, 0, 0, 0);
sync_dispatcher_.QueueSyncMessage(m, delegate, NULL);
SendIpcMessage(m);
}
void CFProxy::ConnectTab(ChromeProxyDelegate* delegate, HWND hwnd,
uint64 cookie) {
- IPC::SyncMessage* m = new AutomationMsg_ConnectExternalTab(0, cookie, true,
+ IPC::SyncMessage* m = new AutomationMsg_ConnectExternalTab(cookie, true,
hwnd, NULL, NULL, NULL, 0);
sync_dispatcher_.QueueSyncMessage(m, delegate, NULL);
SendIpcMessage(m);
}
void CFProxy::BlockTab(uint64 cookie) {
- IPC::SyncMessage* m = new AutomationMsg_ConnectExternalTab(0, cookie, false,
+ IPC::SyncMessage* m = new AutomationMsg_ConnectExternalTab(cookie, false,
NULL, NULL, NULL, NULL, 0);
sync_dispatcher_.QueueSyncMessage(m, NULL, NULL);
SendIpcMessage(m);
}
void CFProxy::Tab_RunUnloadHandlers(int tab) {
- IPC::SyncMessage* m = new AutomationMsg_RunUnloadHandlers(0, tab, 0);
+ IPC::SyncMessage* m = new AutomationMsg_RunUnloadHandlers(tab, 0);
ChromeProxyDelegate* p = Tab2Delegate(tab);
sync_dispatcher_.QueueSyncMessage(m, p, NULL);
SendIpcMessage(m);
@@ -216,13 +215,9 @@ void CFProxy::OnMessageReceived(const IPC::Message& message) {
return;
// Handle tab related message.
- int tab_handle = IsTabMessage(message);
- if (tab_handle != 0) {
- ChromeProxyDelegate* d = Tab2Delegate(tab_handle);
- if (d)
- DispatchTabMessageToDelegate(d, message);
- return;
- }
+ ChromeProxyDelegate* d = Tab2Delegate(message.routing_id());
+ if (d)
+ return d->OnMessageReceived(message);
DLOG(WARNING) << "Unknown message received!";
}
diff --git a/chrome_frame/cfproxy_support.cc b/chrome_frame/cfproxy_support.cc
index 723943a..fea331c 100644
--- a/chrome_frame/cfproxy_support.cc
+++ b/chrome_frame/cfproxy_support.cc
@@ -93,70 +93,70 @@ bool DispatchReplyOk(const IPC::Message* reply_msg, uint32 type,
// Itf2IPCMessage
// Converts and sends trivial messages.
void Interface2IPCMessage::RemoveBrowsingData(int mask) {
- sender_->Send(new AutomationMsg_RemoveBrowsingData(0, mask));
+ sender_->Send(new AutomationMsg_RemoveBrowsingData(mask));
}
void Interface2IPCMessage::SetProxyConfig(
const std::string& json_encoded_proxy_cfg) {
- sender_->Send(new AutomationMsg_SetProxyConfig(0, json_encoded_proxy_cfg));
+ sender_->Send(new AutomationMsg_SetProxyConfig(json_encoded_proxy_cfg));
}
// Tab related.
void Interface2IPCMessage::Tab_PostMessage(int tab, const std::string& message,
const std::string& origin, const std::string& target) {
sender_->Send(new AutomationMsg_HandleMessageFromExternalHost(
- 0, tab, message, origin, target));
+ tab, message, origin, target));
}
void Interface2IPCMessage::Tab_Reload(int tab) {
- sender_->Send(new AutomationMsg_ReloadAsync(0, tab));
+ sender_->Send(new AutomationMsg_ReloadAsync(tab));
}
void Interface2IPCMessage::Tab_Stop(int tab) {
- sender_->Send(new AutomationMsg_StopAsync(0, tab));
+ sender_->Send(new AutomationMsg_StopAsync(tab));
}
void Interface2IPCMessage::Tab_SaveAs(int tab) {
- sender_->Send(new AutomationMsg_SaveAsAsync(0, tab));
+ sender_->Send(new AutomationMsg_SaveAsAsync(tab));
}
void Interface2IPCMessage::Tab_Print(int tab) {
- sender_->Send(new AutomationMsg_PrintAsync(0, tab));
+ sender_->Send(new AutomationMsg_PrintAsync(tab));
}
void Interface2IPCMessage::Tab_Cut(int tab) {
- sender_->Send(new AutomationMsg_Cut(0, tab));
+ sender_->Send(new AutomationMsg_Cut(tab));
}
void Interface2IPCMessage::Tab_Copy(int tab) {
- sender_->Send(new AutomationMsg_Copy(0, tab));
+ sender_->Send(new AutomationMsg_Copy(tab));
}
void Interface2IPCMessage::Tab_Paste(int tab) {
- sender_->Send(new AutomationMsg_Paste(0, tab));
+ sender_->Send(new AutomationMsg_Paste(tab));
}
void Interface2IPCMessage::Tab_SelectAll(int tab) {
- sender_->Send(new AutomationMsg_SelectAll(0, tab));
+ sender_->Send(new AutomationMsg_SelectAll(tab));
}
void Interface2IPCMessage::Tab_MenuCommand(int tab, int selected_command) {
sender_->Send(new AutomationMsg_ForwardContextMenuCommandToChrome(
- 0, tab, selected_command));
+ tab, selected_command));
}
void Interface2IPCMessage::Tab_Zoom(int tab, PageZoom::Function zoom_level) {
- sender_->Send(new AutomationMsg_SetZoomLevel(0, tab, zoom_level));
+ sender_->Send(new AutomationMsg_SetZoomLevel(tab, zoom_level));
}
void Interface2IPCMessage::Tab_FontSize(int tab,
enum AutomationPageFontSize font_size) {
- sender_->Send(new AutomationMsg_SetPageFontSize(0, tab, font_size));
+ sender_->Send(new AutomationMsg_SetPageFontSize(tab, font_size));
}
void Interface2IPCMessage::Tab_SetInitialFocus(int tab, bool reverse,
bool restore_focus_to_view) {
- sender_->Send(new AutomationMsg_SetInitialFocus(0, tab, reverse,
+ sender_->Send(new AutomationMsg_SetInitialFocus(tab, reverse,
restore_focus_to_view));
}
@@ -171,17 +171,17 @@ void Interface2IPCMessage::Tab_Resize(int tab) {
}
void Interface2IPCMessage::Tab_ProcessAccelerator(int tab, const MSG& msg) {
- sender_->Send(new AutomationMsg_ProcessUnhandledAccelerator(0, tab, msg));
+ sender_->Send(new AutomationMsg_ProcessUnhandledAccelerator(tab, msg));
}
// Misc.
void Interface2IPCMessage::Tab_OnHostMoved(int tab) {
- sender_->Send(new AutomationMsg_BrowserMove(0, tab));
+ sender_->Send(new AutomationMsg_BrowserMove(tab));
}
void Interface2IPCMessage::Tab_SetEnableExtensionAutomation(int tab,
const std::vector<std::string>& functions_enabled) {
- sender_->Send(new AutomationMsg_SetEnableExtensionAutomation(0, tab,
+ sender_->Send(new AutomationMsg_SetEnableExtensionAutomation(tab,
functions_enabled));
}
@@ -342,194 +342,3 @@ std::wstring BuildCmdLine(const std::string& channel_id,
}
return command_line_string;
}
-
-int IsTabMessage(const IPC::Message& message) {
- switch (message.type()) {
- case AutomationMsg_NavigationStateChanged::ID:
- case AutomationMsg_UpdateTargetUrl::ID:
- case AutomationMsg_HandleAccelerator::ID:
- case AutomationMsg_TabbedOut::ID:
- case AutomationMsg_OpenURL::ID:
- case AutomationMsg_NavigationFailed::ID:
- case AutomationMsg_DidNavigate::ID:
- case AutomationMsg_TabLoaded::ID:
- case AutomationMsg_ForwardMessageToExternalHost::ID:
- case AutomationMsg_ForwardContextMenuToExternalHost::ID:
- case AutomationMsg_RequestStart::ID:
- case AutomationMsg_RequestRead::ID:
- case AutomationMsg_RequestEnd::ID:
- case AutomationMsg_DownloadRequestInHost::ID:
- case AutomationMsg_SetCookieAsync::ID:
- case AutomationMsg_AttachExternalTab::ID:
- case AutomationMsg_RequestGoToHistoryEntryOffset::ID:
- case AutomationMsg_GetCookiesFromHost::ID:
- case AutomationMsg_CloseExternalTab::ID: {
- // Read tab handle from the message.
- void* iter = NULL;
- int tab_handle = 0;
- message.ReadInt(&iter, &tab_handle);
- return tab_handle;
- }
- }
-
- return 0;
-}
-
-bool DispatchTabMessageToDelegate(ChromeProxyDelegate* delegate,
- const IPC::Message& m) {
- // The first argument of the message is always the tab handle.
- void* iter = 0;
- switch (m.type()) {
- case AutomationMsg_NavigationStateChanged::ID: {
- // Tuple3<int, int, IPC::NavigationInfo>
- AutomationMsg_NavigationStateChanged::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->NavigationStateChanged(params.b, params.c);
- return true;
- }
-
- case AutomationMsg_UpdateTargetUrl::ID: {
- // Tuple2<int, std::wstring>
- AutomationMsg_UpdateTargetUrl::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->UpdateTargetUrl(params.b);
- return true;
- }
-
- case AutomationMsg_HandleAccelerator::ID: {
- // Tuple2<int, MSG>
- AutomationMsg_HandleAccelerator::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->HandleAccelerator(params.b);
- return true;
- }
-
- case AutomationMsg_TabbedOut::ID: {
- // Tuple2<int, bool>
- AutomationMsg_TabbedOut::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->TabbedOut(params.b);
- return true;
- }
-
- case AutomationMsg_OpenURL::ID: {
- // Tuple4<int, GURL, GURL, int>
- AutomationMsg_OpenURL::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->OpenURL(params.b, params.c, params.d);
- return true;
- }
-
- case AutomationMsg_NavigationFailed::ID: {
- // Tuple3<int, int, GURL>
- AutomationMsg_NavigationFailed::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->NavigationFailed(params.b, params.c);
- return true;
- }
-
- case AutomationMsg_DidNavigate::ID: {
- // Tuple2<int, IPC::NavigationInfo>
- AutomationMsg_DidNavigate::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->DidNavigate(params.b);
- return true;
- }
-
- case AutomationMsg_TabLoaded::ID: {
- // Tuple2<int, GURL>
- AutomationMsg_TabLoaded::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->TabLoaded(params.b);
- return true;
- }
-
- case AutomationMsg_ForwardMessageToExternalHost::ID: {
- // Tuple4<int, string, string, string>
- AutomationMsg_ForwardMessageToExternalHost::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->MessageToHost(params.b, params.c, params.d);
- return true;
- }
-
- case AutomationMsg_ForwardContextMenuToExternalHost::ID: {
- // Tuple4<int, HANDLE, int, IPC::ContextMenuParams>
- AutomationMsg_ForwardContextMenuToExternalHost::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->HandleContextMenu(params.b, params.c, params.d);
- return true;
- }
-
- case AutomationMsg_RequestStart::ID: {
- // Tuple3<int, int, IPC::AutomationURLRequest>
- AutomationMsg_RequestStart::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->Network_Start(params.b, params.c);
- return true;
- }
-
- case AutomationMsg_RequestRead::ID: {
- // Tuple3<int, int, int>
- AutomationMsg_RequestRead::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->Network_Read(params.b, params.c);
- return true;
- }
-
- case AutomationMsg_RequestEnd::ID: {
- // Tuple3<int, int, URLRequestStatus>
- AutomationMsg_RequestEnd::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->Network_End(params.b, params.c);
- return true;
- }
-
- case AutomationMsg_DownloadRequestInHost::ID: {
- // Tuple2<int, int>
- AutomationMsg_DownloadRequestInHost::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->Network_DownloadInHost(params.b);
- return true;
- }
-
- case AutomationMsg_SetCookieAsync::ID: {
- // Tuple3<int, GURL, string>
- AutomationMsg_SetCookieAsync::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->SetCookie(params.b, params.c);
- return true;
- }
-
- case AutomationMsg_AttachExternalTab::ID: {
- // Tuple2<int, IPC::AttachExternalTabParams>
- AutomationMsg_AttachExternalTab::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->AttachTab(params.b);
- return true;
- }
-
- case AutomationMsg_RequestGoToHistoryEntryOffset::ID: {
- // Tuple2<int, int>
- AutomationMsg_RequestGoToHistoryEntryOffset::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->GoToHistoryOffset(params.b);
- return true;
- }
-
- case AutomationMsg_GetCookiesFromHost::ID: {
- // Tuple3<int, GURL, int>
- AutomationMsg_GetCookiesFromHost::Param params;
- if (ReadParam(&m, &iter, &params))
- delegate->GetCookies(params.b, params.c);
- return true;
- }
-
- case AutomationMsg_CloseExternalTab::ID: {
- // Tuple1<int>
- delegate->TabClosed();
- return true;
- }
- }
-
- return false;
-}
diff --git a/chrome_frame/cfproxy_test.cc b/chrome_frame/cfproxy_test.cc
index ab615f7..d6be8b1 100644
--- a/chrome_frame/cfproxy_test.cc
+++ b/chrome_frame/cfproxy_test.cc
@@ -28,6 +28,7 @@ struct MockFactory : public ChromeProxyFactory {
};
struct MockChromeProxyDelegate : public ChromeProxyDelegate {
+ MOCK_METHOD1(OnMessageReceived, void(const IPC::Message& message));
MOCK_METHOD1(Connected, void(ChromeProxy* proxy));
MOCK_METHOD2(PeerLost, void(ChromeProxy*, enum DisconnectReason reason));
MOCK_METHOD0(Disconnected, void());
@@ -48,7 +49,7 @@ struct MockChromeProxyDelegate : public ChromeProxyDelegate {
// Network requests from Chrome.
MOCK_METHOD2(Network_Start, void(int request_id,
- const IPC::AutomationURLRequest& request_info));
+ const AutomationURLRequest& request_info));
MOCK_METHOD2(Network_Read, void(int request_id, int bytes_to_read));
MOCK_METHOD2(Network_End, void(int request_id, const URLRequestStatus& s));
MOCK_METHOD1(Network_DownloadInHost, void(int request_id));
@@ -57,10 +58,10 @@ struct MockChromeProxyDelegate : public ChromeProxyDelegate {
// Navigation progress notifications.
MOCK_METHOD2(NavigationStateChanged, void(int flags,
- const IPC::NavigationInfo& nav_info));
+ const NavigationInfo& nav_info));
MOCK_METHOD1(UpdateTargetUrl, void(const std::wstring& url));
MOCK_METHOD2(NavigationFailed, void(int error_code, const GURL& gurl));
- MOCK_METHOD1(DidNavigate, void(const IPC::NavigationInfo& navigation_info));
+ MOCK_METHOD1(DidNavigate, void(const NavigationInfo& navigation_info));
MOCK_METHOD1(TabLoaded, void(const GURL& url));
//
@@ -73,13 +74,12 @@ struct MockChromeProxyDelegate : public ChromeProxyDelegate {
// Misc. UI.
MOCK_METHOD1(HandleAccelerator, void(const MSG& accel_message));
MOCK_METHOD3(HandleContextMenu, void(HANDLE menu_handle, int align_flags,
- const IPC::MiniContextMenuParams& params));
+ const MiniContextMenuParams& params));
MOCK_METHOD1(TabbedOut, void(bool reverse));
//
MOCK_METHOD0(TabClosed, void());
- MOCK_METHOD1(AttachTab,
- void(const IPC::AttachExternalTabParams& attach_params));
+ MOCK_METHOD1(AttachTab, void(const AttachExternalTabParams& attach_params));
};
struct MockSender : public IPC::Message::Sender {
@@ -342,8 +342,8 @@ TEST(SyncMsgSender, Deserialize) {
const int kSessionId = 8;
// Create some sync messages and their replies.
- AutomationMsg_InstallExtension m1(0, FilePath(L"c:\\awesome.x"), 0);
- AutomationMsg_CreateExternalTab m2(0, IPC::ExternalTabSettings(), 0, 0, 0, 0);
+ AutomationMsg_InstallExtension m1(FilePath(L"c:\\awesome.x"), 0);
+ AutomationMsg_CreateExternalTab m2(ExternalTabSettings(), 0, 0, 0, 0);
scoped_ptr<IPC::Message> r1(CreateReply(&m1,
AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED));
scoped_ptr<IPC::Message> r2(CreateReply(&m2, (HWND)1, (HWND)2, kTabHandle,
@@ -372,175 +372,3 @@ TEST(SyncMsgSender, Deserialize) {
TEST(SyncMsgSender, OnChannelClosed) {
// TODO(stoyan): implement.
}
-
-MATCHER_P(EqNavigationInfo, ni, "") {
- return arg.navigation_type == ni.navigation_type &&
- arg.relative_offset == ni.relative_offset &&
- arg.navigation_index == ni.navigation_index &&
- arg.title == ni.title &&
- arg.url == ni.url &&
- arg.referrer == ni.referrer &&
- arg.security_style == ni.security_style &&
- arg.displayed_insecure_content == ni.displayed_insecure_content &&
- arg.ran_insecure_content == ni.ran_insecure_content;
-}
-
-MATCHER_P(EqMSG, msg, "") {
- return arg.hwnd == msg.hwnd &&
- arg.message == msg.message &&
- arg.wParam == msg.wParam &&
- arg.lParam == msg.lParam &&
- arg.time == msg.time &&
- arg.pt.x == msg.pt.x &&
- arg.pt.y == msg.pt.y;
-}
-
-MATCHER_P(EqContextMenuParam, p, "") {
- return arg.screen_x == p.screen_x &&
- arg.screen_y == p.screen_y &&
- arg.link_url == p.link_url &&
- arg.unfiltered_link_url == p.unfiltered_link_url &&
- arg.src_url == p.src_url &&
- arg.page_url == p.page_url &&
- arg.frame_url == p.frame_url;
-}
-
-MATCHER_P(EqURLRequest, p, "") {
- return arg.url == p.url &&
- arg.method == p.method &&
- arg.referrer == p.referrer &&
- arg.extra_request_headers == p.extra_request_headers &&
- // TODO(stoyan): scoped_refptr<net::UploadData> upload_data;
- arg.resource_type == p.resource_type;
-}
-
-
-MATCHER_P(EqAttachExternalTab, p, "") {
- return arg.cookie == p.cookie &&
- arg.url == p.url &&
- arg.dimensions == p.dimensions &&
- arg.disposition == p.disposition &&
- arg.user_gesture == p.user_gesture &&
- arg.profile_name == p.profile_name;
-}
-
-TEST(Deserialize, DispatchTabMessage) {
- testing::InSequence s;
- StrictMock<MockChromeProxyDelegate> delegate;
- GURL url("http://destination");
- GURL ref("http://referer");
-
- // Tuple3<int, int, IPC::NavigationInfo>
- int flags = 2;
- IPC::NavigationInfo ni(2, 3, 4, L"title", url,
- ref, SECURITY_STYLE_AUTHENTICATION_BROKEN, true, true);
- AutomationMsg_NavigationStateChanged m1(0, 1, flags, ni);
- EXPECT_CALL(delegate, NavigationStateChanged(flags, EqNavigationInfo(ni)));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m1));
-
- // Tuple2<int, std::wstring>
- AutomationMsg_UpdateTargetUrl m2(0, 1, L"hello");
- EXPECT_CALL(delegate, UpdateTargetUrl(StrEq(L"hello")));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m2));
-
- // Tuple2<int, MSG>
- MSG wnd_msg = {0, WM_DESTROY, 1, 9, 0x5671, { 11, 12 }};
- AutomationMsg_HandleAccelerator m3(0, 1, wnd_msg);
- EXPECT_CALL(delegate, HandleAccelerator(EqMSG(wnd_msg)));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m3));
-
- // Tuple2<int, bool>
- AutomationMsg_TabbedOut m4(0, 1, true);
- EXPECT_CALL(delegate, TabbedOut(true));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m4));
-
-
- // Tuple4<int, GURL, GURL, int>
- AutomationMsg_OpenURL m5(0, 1, url, ref, 4);
- EXPECT_CALL(delegate, OpenURL(url, ref, 4));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m5));
-
- // Tuple3<int, int, GURL>
- AutomationMsg_NavigationFailed m6(0, 1, 2, url);
- EXPECT_CALL(delegate, NavigationFailed(2, url));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m6));
-
-
- // Tuple2<int, IPC::NavigationInfo>
- AutomationMsg_DidNavigate m7(0, 1, ni);
- EXPECT_CALL(delegate, DidNavigate(EqNavigationInfo(ni)));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m7));
-
-
- // Tuple2<int, GURL>
- AutomationMsg_TabLoaded m8(0, 1, url);
- EXPECT_CALL(delegate, TabLoaded(url));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m8));
-
- // Tuple4<int, string, string, string>
- std::string msg("Load oranges barrels");
- std::string origin("Brothers Karamazov");
- std::string target("Alexander Ivanovich");
- AutomationMsg_ForwardMessageToExternalHost m9(0, 1, msg, origin, target);
- EXPECT_CALL(delegate, MessageToHost(msg, origin, target));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m9));
-
- // Tuple4<int, HANDLE, int, IPC::ContextMenuParams>
- IPC::MiniContextMenuParams ctxmenu(711, 512, GURL("http://link_src"),
- GURL("http://unfiltered_link_url"), GURL("http://src_url"),
- GURL("http://page_url"), GURL("http://frame_url"));
- AutomationMsg_ForwardContextMenuToExternalHost m10(0, 1, HANDLE(7), 4,
- ctxmenu);
- EXPECT_CALL(delegate, HandleContextMenu(HANDLE(7), 4,
- EqContextMenuParam(ctxmenu)));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m10));
-
- // Tuple3<int, int, IPC::AutomationURLRequest>
- IPC::AutomationURLRequest url_request("url", "post", "referer",
- "extra_headers", 0, 3, 0);
- AutomationMsg_RequestStart m11(0, 1, 7, url_request);
- EXPECT_CALL(delegate, Network_Start(7, EqURLRequest(url_request)));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m11));
-
- // Tuple3<int, int, int>
- AutomationMsg_RequestRead m12(0, 1, 7, 16384);
- EXPECT_CALL(delegate, Network_Read(7, 16384));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m12));
-
- // Tuple3<int, int, URLRequestStatus>
- AutomationMsg_RequestEnd m13(0, 1, 7, URLRequestStatus());
- EXPECT_CALL(delegate, Network_End(7, _));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m13));
-
- // Tuple2<int, int>
- AutomationMsg_DownloadRequestInHost m14(0, 1, 7);
- EXPECT_CALL(delegate, Network_DownloadInHost(7));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m14));
-
- // Tuple3<int, GURL, string>
- AutomationMsg_SetCookieAsync m15(0, 1, url, "cake=big");
- EXPECT_CALL(delegate, SetCookie(url, "cake=big"));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m15));
-
- // Tuple2<int, IPC::AttachExternalTabParams>
- IPC::AttachExternalTabParams ext_tab(0xFEDCBA0987654321i64, url,
- gfx::Rect(6, 9, 123, 999), 1,
- false, "theprofile");
- AutomationMsg_AttachExternalTab m16(0, 1, ext_tab);
- EXPECT_CALL(delegate, AttachTab(EqAttachExternalTab(ext_tab)));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m16));
-
- // Tuple2<int, int>
- AutomationMsg_RequestGoToHistoryEntryOffset m17(0, 1, -4);
- EXPECT_CALL(delegate, GoToHistoryOffset(-4));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m17));
-
- // Tuple3<int, GURL, int>
- AutomationMsg_GetCookiesFromHost m18(0, 1, url, 903);
- EXPECT_CALL(delegate, GetCookies(url, 903));
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m18));
-
- AutomationMsg_CloseExternalTab m19(0, 1);
- EXPECT_CALL(delegate, TabClosed());
- EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m19));
-}
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc
index ba2390b..b726797 100644
--- a/chrome_frame/chrome_active_document.cc
+++ b/chrome_frame/chrome_active_document.cc
@@ -615,8 +615,8 @@ HRESULT ChromeActiveDocument::ActiveXDocActivate(LONG verb) {
return S_OK;
}
-void ChromeActiveDocument::OnNavigationStateChanged(int tab_handle, int flags,
- const IPC::NavigationInfo& nav_info) {
+void ChromeActiveDocument::OnNavigationStateChanged(
+ int flags, const NavigationInfo& nav_info) {
// TODO(joshia): handle INVALIDATE_TAB,INVALIDATE_LOAD etc.
DVLOG(1) << __FUNCTION__
<< "\n Flags: " << flags
@@ -629,7 +629,7 @@ void ChromeActiveDocument::OnNavigationStateChanged(int tab_handle, int flags,
UpdateNavigationState(nav_info);
}
-void ChromeActiveDocument::OnUpdateTargetUrl(int tab_handle,
+void ChromeActiveDocument::OnUpdateTargetUrl(
const std::wstring& new_target_url) {
if (in_place_frame_)
in_place_frame_->SetStatusText(new_target_url.c_str());
@@ -643,8 +643,7 @@ bool IsFindAccelerator(const MSG& msg) {
!(win_util::IsAltPressed() || win_util::IsShiftPressed());
}
-void ChromeActiveDocument::OnAcceleratorPressed(int tab_handle,
- const MSG& accel_message) {
+void ChromeActiveDocument::OnAcceleratorPressed(const MSG& accel_message) {
if (::TranslateAccelerator(m_hWnd, accelerator_table_,
const_cast<MSG*>(&accel_message)))
return;
@@ -660,14 +659,14 @@ void ChromeActiveDocument::OnAcceleratorPressed(int tab_handle,
// Handle the showing of the find dialog explicitly.
OnFindInPage();
} else {
- BaseActiveX::OnAcceleratorPressed(tab_handle, accel_message);
+ BaseActiveX::OnAcceleratorPressed(accel_message);
}
} else {
DVLOG(1) << "IE handled accel key " << accel_message.wParam;
}
}
-void ChromeActiveDocument::OnTabbedOut(int tab_handle, bool reverse) {
+void ChromeActiveDocument::OnTabbedOut(bool reverse) {
DVLOG(1) << __FUNCTION__;
if (in_place_frame_) {
MSG msg = { NULL, WM_KEYDOWN, VK_TAB };
@@ -675,8 +674,7 @@ void ChromeActiveDocument::OnTabbedOut(int tab_handle, bool reverse) {
}
}
-void ChromeActiveDocument::OnDidNavigate(int tab_handle,
- const IPC::NavigationInfo& nav_info) {
+void ChromeActiveDocument::OnDidNavigate(const NavigationInfo& nav_info) {
DVLOG(1) << __FUNCTION__ << std::endl
<< "Url: " << nav_info.url
<< ", Title: " << nav_info.title
@@ -696,9 +694,9 @@ void ChromeActiveDocument::OnDidNavigate(int tab_handle,
UpdateNavigationState(nav_info);
}
-void ChromeActiveDocument::OnCloseTab(int tab_handle) {
+void ChromeActiveDocument::OnCloseTab() {
// Base class will fire DIChromeFrameEvents::onclose.
- BaseActiveX::OnCloseTab(tab_handle);
+ BaseActiveX::OnCloseTab();
// Close the container window.
ScopedComPtr<IWebBrowser2> web_browser2;
@@ -708,7 +706,7 @@ void ChromeActiveDocument::OnCloseTab(int tab_handle) {
}
void ChromeActiveDocument::UpdateNavigationState(
- const IPC::NavigationInfo& new_navigation_info) {
+ const NavigationInfo& new_navigation_info) {
HRESULT hr = S_OK;
bool is_title_changed = (navigation_info_.title != new_navigation_info.title);
bool is_ssl_state_changed =
@@ -919,8 +917,7 @@ void ChromeActiveDocument::OnUnload(const GUID* cmd_group_guid,
}
}
-void ChromeActiveDocument::OnOpenURL(int tab_handle,
- const GURL& url_to_open,
+void ChromeActiveDocument::OnOpenURL(const GURL& url_to_open,
const GURL& referrer,
int open_disposition) {
// If the disposition indicates that we should be opening the URL in the
@@ -934,11 +931,11 @@ void ChromeActiveDocument::OnOpenURL(int tab_handle,
g_active_doc_cache.Set(this);
}
- BaseActiveX::OnOpenURL(tab_handle, url_to_open, referrer, open_disposition);
+ BaseActiveX::OnOpenURL(url_to_open, referrer, open_disposition);
}
-void ChromeActiveDocument::OnAttachExternalTab(int tab_handle,
- const IPC::AttachExternalTabParams& params) {
+void ChromeActiveDocument::OnAttachExternalTab(
+ const AttachExternalTabParams& params) {
if (!automation_client_.get()) {
DLOG(WARNING) << "Invalid automation client instance";
return;
@@ -957,7 +954,7 @@ void ChromeActiveDocument::OnAttachExternalTab(int tab_handle,
}
// Allow popup
if (hr == S_OK) {
- BaseActiveX::OnAttachExternalTab(tab_handle, params);
+ BaseActiveX::OnAttachExternalTab(params);
return;
}
@@ -984,8 +981,8 @@ bool ChromeActiveDocument::PreProcessContextMenu(HMENU menu) {
return BaseActiveX::PreProcessContextMenu(menu);
}
-bool ChromeActiveDocument::HandleContextMenuCommand(UINT cmd,
- const IPC::MiniContextMenuParams& params) {
+bool ChromeActiveDocument::HandleContextMenuCommand(
+ UINT cmd, const MiniContextMenuParams& params) {
ScopedComPtr<IWebBrowser2> web_browser2;
DoQueryService(SID_SWebBrowserApp, m_spClientSite, web_browser2.Receive());
@@ -1233,8 +1230,7 @@ HRESULT ChromeActiveDocument::OnEncodingChange(const GUID* cmd_group_guid,
return S_OK;
}
-void ChromeActiveDocument::OnGoToHistoryEntryOffset(int tab_handle,
- int offset) {
+void ChromeActiveDocument::OnGoToHistoryEntryOffset(int offset) {
DVLOG(1) << __FUNCTION__ << " - offset:" << offset;
ScopedComPtr<IBrowserService> browser_service;
@@ -1367,7 +1363,7 @@ void ChromeActiveDocument::SetWindowDimensions() {
}
bool ChromeActiveDocument::IsNewNavigation(
- const IPC::NavigationInfo& new_navigation_info) const {
+ const NavigationInfo& new_navigation_info) const {
// A new navigation is typically an internal navigation which is initiated by
// the renderer(WebKit). Condition 1 below has to be true along with the
// any of the other conditions below.
diff --git a/chrome_frame/chrome_active_document.h b/chrome_frame/chrome_active_document.h
index 55ee24f..598966b 100644
--- a/chrome_frame/chrome_active_document.h
+++ b/chrome_frame/chrome_active_document.h
@@ -280,15 +280,13 @@ BEGIN_EXEC_COMMAND_MAP(ChromeActiveDocument)
END_EXEC_COMMAND_MAP()
// IPCs from automation server.
- virtual void OnNavigationStateChanged(int tab_handle, int flags,
- const IPC::NavigationInfo& nav_info);
- virtual void OnUpdateTargetUrl(int tab_handle,
- const std::wstring& new_target_url);
- virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message);
- virtual void OnTabbedOut(int tab_handle, bool reverse);
- virtual void OnDidNavigate(int tab_handle,
- const IPC::NavigationInfo& nav_info);
- virtual void OnCloseTab(int tab_handle);
+ virtual void OnNavigationStateChanged(
+ int flags, const NavigationInfo& nav_info);
+ virtual void OnUpdateTargetUrl(const std::wstring& new_target_url);
+ virtual void OnAcceleratorPressed(const MSG& accel_message);
+ virtual void OnTabbedOut(bool reverse);
+ virtual void OnDidNavigate(const NavigationInfo& nav_info);
+ virtual void OnCloseTab();
// Override DoVerb
STDMETHOD(DoVerb)(LONG verb,
LPMSG msg,
@@ -344,8 +342,7 @@ END_EXEC_COMMAND_MAP()
// Callbacks from ChromeFramePlugin<T>
bool PreProcessContextMenu(HMENU menu);
- bool HandleContextMenuCommand(UINT cmd,
- const IPC::MiniContextMenuParams& params);
+ bool HandleContextMenuCommand(UINT cmd, const MiniContextMenuParams& params);
// ChromeFramePlugin overrides.
virtual void OnAutomationServerReady();
@@ -364,16 +361,15 @@ END_EXEC_COMMAND_MAP()
protected:
// ChromeFrameActivexBase overrides
- virtual void OnOpenURL(int tab_handle, const GURL& url_to_open,
- const GURL& referrer, int open_disposition);
- virtual void OnAttachExternalTab(int tab_handle,
- const IPC::AttachExternalTabParams& params);
- virtual void OnGoToHistoryEntryOffset(int tab_handle, int offset);
+ virtual void OnOpenURL(
+ const GURL& url_to_open, const GURL& referrer, int open_disposition);
+ virtual void OnAttachExternalTab(const AttachExternalTabParams& params);
+ virtual void OnGoToHistoryEntryOffset(int offset);
// A helper method that updates our internal navigation state
// as well as IE's navigation state (viz Title and current URL).
// The navigation_flags is a TabContents::InvalidateTypes enum
- void UpdateNavigationState(const IPC::NavigationInfo& nav_info);
+ void UpdateNavigationState(const NavigationInfo& nav_info);
TabProxy* GetTabProxy() const {
if (automation_client_.get())
@@ -446,12 +442,12 @@ END_EXEC_COMMAND_MAP()
// Returns true if the NavigationInfo object passed in represents a new
// navigation initiated by the renderer.
- bool IsNewNavigation(const IPC::NavigationInfo& new_navigation_info) const;
+ bool IsNewNavigation(const NavigationInfo& new_navigation_info) const;
protected:
typedef std::map<int, OLECMDF> CommandStatusMap;
- IPC::NavigationInfo navigation_info_;
+ NavigationInfo navigation_info_;
bool is_doc_object_;
// This indicates whether this is the first navigation in this
diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc
index fe3a36a..ce5f386 100644
--- a/chrome_frame/chrome_frame_activex.cc
+++ b/chrome_frame/chrome_frame_activex.cc
@@ -182,14 +182,14 @@ HRESULT ChromeFrameActivex::GetDocumentWindow(IHTMLWindow2** window) {
return hr;
}
-void ChromeFrameActivex::OnLoad(int tab_handle, const GURL& gurl) {
+void ChromeFrameActivex::OnLoad(const GURL& gurl) {
ScopedComPtr<IDispatch> event;
std::string url = gurl.spec();
if (SUCCEEDED(CreateDomEvent("event", url, "", event.Receive())))
Fire_onload(event);
FireEvent(onload_, url);
- Base::OnLoad(tab_handle, gurl);
+ Base::OnLoad(gurl);
}
void ChromeFrameActivex::OnLoadFailed(int error_code, const std::string& url) {
@@ -201,8 +201,7 @@ void ChromeFrameActivex::OnLoadFailed(int error_code, const std::string& url) {
Base::OnLoadFailed(error_code, url);
}
-void ChromeFrameActivex::OnMessageFromChromeFrame(int tab_handle,
- const std::string& message,
+void ChromeFrameActivex::OnMessageFromChromeFrame(const std::string& message,
const std::string& origin,
const std::string& target) {
DVLOG(1) << __FUNCTION__;
diff --git a/chrome_frame/chrome_frame_activex.h b/chrome_frame/chrome_frame_activex.h
index 8fee559..bbad3e8 100644
--- a/chrome_frame/chrome_frame_activex.h
+++ b/chrome_frame/chrome_frame_activex.h
@@ -90,9 +90,8 @@ END_MSG_MAP()
protected:
// ChromeFrameDelegate overrides
- virtual void OnLoad(int tab_handle, const GURL& url);
- virtual void OnMessageFromChromeFrame(int tab_handle,
- const std::string& message,
+ virtual void OnLoad(const GURL& url);
+ virtual void OnMessageFromChromeFrame(const std::string& message,
const std::string& origin,
const std::string& target);
virtual void OnLoadFailed(int error_code, const std::string& url);
diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h
index dfc3da0..cedd526 100644
--- a/chrome_frame/chrome_frame_activex_base.h
+++ b/chrome_frame/chrome_frame_activex_base.h
@@ -349,8 +349,7 @@ END_MSG_MAP()
return CComControlBase::IOleObject_SetClientSite(client_site);
}
- bool HandleContextMenuCommand(UINT cmd,
- const IPC::MiniContextMenuParams& params) {
+ bool HandleContextMenuCommand(UINT cmd, const MiniContextMenuParams& params) {
if (cmd == IDC_ABOUT_CHROME_FRAME) {
int tab_handle = automation_client_->tab()->handle();
HostNavigate(GURL("about:version"), GURL(), NEW_WINDOW);
@@ -415,7 +414,7 @@ END_MSG_MAP()
DVLOG(1) << __FUNCTION__ << ": " << profile_path->value();
}
- void OnLoad(int tab_handle, const GURL& url) {
+ void OnLoad(const GURL& url) {
if (ready_state_ < READYSTATE_COMPLETE) {
ready_state_ = READYSTATE_COMPLETE;
FireOnChanged(DISPID_READYSTATE);
@@ -428,7 +427,7 @@ END_MSG_MAP()
HRESULT hr = InvokeScriptFunction(onerror_handler_, url);
}
- void OnMessageFromChromeFrame(int tab_handle, const std::string& message,
+ void OnMessageFromChromeFrame(const std::string& message,
const std::string& origin,
const std::string& target) {
base::win::ScopedComPtr<IDispatch> message_event;
@@ -440,7 +439,7 @@ END_MSG_MAP()
}
}
- virtual void OnTabbedOut(int tab_handle, bool reverse) {
+ virtual void OnTabbedOut(bool reverse) {
DCHECK(m_bInPlaceActive);
HWND parent = ::GetParent(m_hWnd);
@@ -451,7 +450,7 @@ END_MSG_MAP()
control_site->OnFocus(FALSE);
}
- virtual void OnOpenURL(int tab_handle, const GURL& url_to_open,
+ virtual void OnOpenURL(const GURL& url_to_open,
const GURL& referrer, int open_disposition) {
HostNavigate(url_to_open, referrer, open_disposition);
}
@@ -480,8 +479,7 @@ END_MSG_MAP()
return TRUE;
}
- virtual void OnAttachExternalTab(int tab_handle,
- const IPC::AttachExternalTabParams& params) {
+ virtual void OnAttachExternalTab(const AttachExternalTabParams& params) {
std::wstring wide_url = url_;
GURL parsed_url(WideToUTF8(wide_url));
@@ -515,12 +513,11 @@ END_MSG_MAP()
HostNavigate(GURL(url), GURL(), params.disposition);
}
- virtual void OnHandleContextMenu(int tab_handle, HANDLE menu_handle,
+ virtual void OnHandleContextMenu(HANDLE menu_handle,
int align_flags,
- const IPC::MiniContextMenuParams& params) {
+ const MiniContextMenuParams& params) {
scoped_refptr<BasePlugin> ref(this);
- ChromeFramePlugin<T>::OnHandleContextMenu(tab_handle, menu_handle,
- align_flags, params);
+ ChromeFramePlugin<T>::OnHandleContextMenu(menu_handle, align_flags, params);
}
LRESULT OnCreate(UINT message, WPARAM wparam, LPARAM lparam,
@@ -567,7 +564,7 @@ END_MSG_MAP()
FireOnChanged(DISPID_READYSTATE);
}
- virtual void OnCloseTab(int tab_handle) {
+ virtual void OnCloseTab() {
Fire_onclose();
}
@@ -1093,7 +1090,7 @@ END_MSG_MAP()
return hr;
}
- virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message) {
+ virtual void OnAcceleratorPressed(const MSG& accel_message) {
DCHECK(m_spInPlaceSite != NULL);
// Allow our host a chance to handle the accelerator.
// This catches things like Ctrl+F, Ctrl+O etc, but not browser
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc
index e0d8ead..a026669 100644
--- a/chrome_frame/chrome_frame_automation.cc
+++ b/chrome_frame/chrome_frame_automation.cc
@@ -67,17 +67,17 @@ class ChromeFrameAutomationProxyImpl::TabProxyNotificationMessageFilter
if (message.is_reply())
return false;
- int tab_handle = 0;
- if (!ChromeFrameDelegateImpl::IsTabMessage(message, &tab_handle))
+ if (!ChromeFrameDelegateImpl::IsTabMessage(message))
return false;
// Get AddRef-ed pointer to corresponding TabProxy object
- TabProxy* tab = static_cast<TabProxy*>(tracker_->GetResource(tab_handle));
+ TabProxy* tab = static_cast<TabProxy*>(tracker_->GetResource(
+ message.routing_id()));
if (tab) {
tab->OnMessageReceived(message);
tab->Release();
} else {
- DLOG(ERROR) << "Failed to find TabProxy for tab:" << tab_handle;
+ DLOG(ERROR) << "Failed to find TabProxy for tab:" << message.routing_id();
}
return true;
}
@@ -447,7 +447,7 @@ void AutomationProxyCacheEntry::SendUMAData() {
snapshots_->GatherAllHistograms();
if (!histograms.empty()) {
- proxy_->Send(new AutomationMsg_RecordHistograms(0, histograms));
+ proxy_->Send(new AutomationMsg_RecordHistograms(histograms));
}
MessageLoop::current()->PostDelayedTask(FROM_HERE,
@@ -762,7 +762,7 @@ bool ChromeFrameAutomationClient::NavigateToIndex(int index) {
DCHECK(::IsWindow(chrome_window_));
IPC::SyncMessage* msg = new AutomationMsg_NavigateExternalTabAtIndex(
- 0, tab_->handle(), index, NULL);
+ tab_->handle(), index, NULL);
automation_server_->SendAsAsync(msg, new BeginNavigateContext(this),
this);
return true;
@@ -804,7 +804,7 @@ void ChromeFrameAutomationClient::BeginNavigate() {
}
IPC::SyncMessage* msg =
- new AutomationMsg_NavigateInExternalTab(0, tab_->handle(),
+ new AutomationMsg_NavigateInExternalTab(tab_->handle(),
chrome_launch_params_->url(), chrome_launch_params_->referrer(),
NULL);
automation_server_->SendAsAsync(msg, new BeginNavigateContext(this), this);
@@ -840,7 +840,7 @@ void ChromeFrameAutomationClient::FindInPage(const std::wstring& search_string,
params.forward = (forward == FWD);
IPC::SyncMessage* msg =
- new AutomationMsg_Find(0, tab_->handle(), params, NULL, NULL);
+ new AutomationMsg_Find(tab_->handle(), params, NULL, NULL);
automation_server_->SendAsAsync(msg, NULL, this);
}
@@ -857,8 +857,7 @@ void ChromeFrameAutomationClient::InstallExtension(
InstallExtensionContext* ctx = new InstallExtensionContext(
this, crx_path, user_data);
- IPC::SyncMessage* msg =
- new AutomationMsg_InstallExtension(0, crx_path, NULL);
+ IPC::SyncMessage* msg = new AutomationMsg_InstallExtension(crx_path, NULL);
// The context will delete itself after it is called.
automation_server_->SendAsAsync(msg, ctx, this);
@@ -885,7 +884,7 @@ void ChromeFrameAutomationClient::GetEnabledExtensions(void* user_data) {
this, user_data);
IPC::SyncMessage* msg = new AutomationMsg_GetEnabledExtensions(
- 0, ctx->extension_directories());
+ ctx->extension_directories());
// The context will delete itself after it is called.
automation_server_->SendAsAsync(msg, ctx, this);
@@ -932,8 +931,7 @@ void ChromeFrameAutomationClient::LoadExpandedExtension(
InstallExtensionContext* ctx = new InstallExtensionContext(
this, path, user_data);
- IPC::SyncMessage* msg =
- new AutomationMsg_LoadExpandedExtension(0, path, NULL);
+ IPC::SyncMessage* msg = new AutomationMsg_LoadExpandedExtension(path, NULL);
// The context will delete itself after it is called.
automation_server_->SendAsAsync(msg, ctx, this);
@@ -948,7 +946,7 @@ void ChromeFrameAutomationClient::CreateExternalTab() {
navigate_after_initialization_ = false;
}
- const IPC::ExternalTabSettings settings(
+ const ExternalTabSettings settings(
m_hWnd,
gfx::Rect(),
WS_CHILD,
@@ -969,7 +967,7 @@ void ChromeFrameAutomationClient::CreateExternalTab() {
2);
IPC::SyncMessage* message =
- new AutomationMsg_CreateExternalTab(0, settings, NULL, NULL, 0, 0);
+ new AutomationMsg_CreateExternalTab(settings, NULL, NULL, 0, 0);
automation_server_->SendAsAsync(message, new CreateExternalTabContext(this),
this);
}
@@ -1038,7 +1036,7 @@ void ChromeFrameAutomationClient::LaunchComplete(
// Send a notification to Chrome that we are ready to connect to the
// ExternalTab.
IPC::SyncMessage* message =
- new AutomationMsg_ConnectExternalTab(0, external_tab_cookie_, true,
+ new AutomationMsg_ConnectExternalTab(external_tab_cookie_, true,
m_hWnd, NULL, NULL, NULL, 0);
automation_server_->SendAsAsync(message,
new CreateExternalTabContext(this),
@@ -1374,7 +1372,7 @@ void ChromeFrameAutomationClient::AttachExternalTab(
void ChromeFrameAutomationClient::BlockExternalTab(uint64 cookie) {
// The host does not want this tab to be shown (due popup blocker).
IPC::SyncMessage* message =
- new AutomationMsg_ConnectExternalTab(0, cookie, false, m_hWnd,
+ new AutomationMsg_ConnectExternalTab(cookie, false, m_hWnd,
NULL, NULL, NULL, 0);
automation_server_->SendAsAsync(message, NULL, this);
}
@@ -1389,12 +1387,11 @@ void ChromeFrameAutomationClient::SetPageFontSize(
}
automation_server_->Send(
- new AutomationMsg_SetPageFontSize(0, tab_handle_, font_size));
+ new AutomationMsg_SetPageFontSize(tab_handle_, font_size));
}
void ChromeFrameAutomationClient::RemoveBrowsingData(int remove_mask) {
- automation_server_->Send(
- new AutomationMsg_RemoveBrowsingData(0, remove_mask));
+ automation_server_->Send(new AutomationMsg_RemoveBrowsingData(remove_mask));
}
void ChromeFrameAutomationClient::SetUrlFetcher(
@@ -1407,7 +1404,7 @@ void ChromeFrameAutomationClient::SetUrlFetcher(
void ChromeFrameAutomationClient::SetZoomLevel(PageZoom::Function zoom_level) {
if (automation_server_) {
- automation_server_->Send(new AutomationMsg_SetZoomLevel(0, tab_handle_,
+ automation_server_->Send(new AutomationMsg_SetZoomLevel(tab_handle_,
zoom_level));
}
}
@@ -1417,7 +1414,7 @@ void ChromeFrameAutomationClient::OnUnload(bool* should_unload) {
if (automation_server_) {
const DWORD kUnloadEventTimeout = 20000;
- IPC::SyncMessage* msg = new AutomationMsg_RunUnloadHandlers(0, tab_handle_,
+ IPC::SyncMessage* msg = new AutomationMsg_RunUnloadHandlers(tab_handle_,
should_unload);
base::WaitableEvent unload_call_finished(false, false);
UnloadContext* unload_context = new UnloadContext(&unload_call_finished,
@@ -1436,7 +1433,7 @@ void ChromeFrameAutomationClient::OnResponseStarted(int request_id,
const char* mime_type, const char* headers, int size,
base::Time last_modified, const std::string& redirect_url,
int redirect_status) {
- const IPC::AutomationURLResponse response(
+ const AutomationURLResponse response(
mime_type,
headers ? headers : "",
size,
@@ -1444,24 +1441,24 @@ void ChromeFrameAutomationClient::OnResponseStarted(int request_id,
redirect_url,
redirect_status);
- automation_server_->Send(new AutomationMsg_RequestStarted(0,
+ automation_server_->Send(new AutomationMsg_RequestStarted(
tab_->handle(), request_id, response));
}
void ChromeFrameAutomationClient::OnReadComplete(int request_id,
const std::string& data) {
- automation_server_->Send(new AutomationMsg_RequestData(0, tab_->handle(),
- request_id, data));
+ automation_server_->Send(new AutomationMsg_RequestData(
+ tab_->handle(), request_id, data));
}
void ChromeFrameAutomationClient::OnResponseEnd(int request_id,
const URLRequestStatus& status) {
- automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(),
- request_id, status));
+ automation_server_->Send(new AutomationMsg_RequestEnd(
+ tab_->handle(), request_id, status));
}
void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success,
const GURL& url, const std::string& cookie_string, int cookie_id) {
- automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0,
+ automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(
tab_->handle(), success, url, cookie_string, cookie_id));
}
diff --git a/chrome_frame/chrome_frame_delegate.cc b/chrome_frame/chrome_frame_delegate.cc
index 6d3186a..cd54c5f 100644
--- a/chrome_frame/chrome_frame_delegate.cc
+++ b/chrome_frame/chrome_frame_delegate.cc
@@ -4,8 +4,7 @@
#include "chrome_frame/chrome_frame_delegate.h"
-bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message,
- int* tab_handle) {
+bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message) {
bool is_tab_message = true;
IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, message)
IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationStateChanged, )
@@ -31,12 +30,6 @@ bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message,
IPC_MESSAGE_UNHANDLED(is_tab_message = false);
IPC_END_MESSAGE_MAP()
- if (is_tab_message) {
- // Read tab handle from the message.
- void* iter = NULL;
- is_tab_message = message.ReadInt(&iter, tab_handle);
- }
-
return is_tab_message;
}
diff --git a/chrome_frame/chrome_frame_delegate.h b/chrome_frame/chrome_frame_delegate.h
index c7890b7..647f0d0 100644
--- a/chrome_frame/chrome_frame_delegate.h
+++ b/chrome_frame/chrome_frame_delegate.h
@@ -79,7 +79,7 @@ class ChromeFrameDelegateImpl : public ChromeFrameDelegate {
virtual void OnMessageReceived(const IPC::Message& msg);
virtual void OnChannelError() {}
- static bool IsTabMessage(const IPC::Message& message, int* tab_handle);
+ static bool IsTabMessage(const IPC::Message& message);
virtual bool IsValid() const {
return true;
@@ -89,42 +89,33 @@ class ChromeFrameDelegateImpl : public ChromeFrameDelegate {
protected:
// Protected methods to be overriden.
- virtual void OnNavigationStateChanged(int tab_handle, int flags,
- const IPC::NavigationInfo& nav_info) {}
- virtual void OnUpdateTargetUrl(int tab_handle,
- const std::wstring& new_target_url) {}
- virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message) {}
- virtual void OnTabbedOut(int tab_handle, bool reverse) {}
- virtual void OnOpenURL(int tab_handle, const GURL& url,
- const GURL& referrer, int open_disposition) {}
- virtual void OnDidNavigate(int tab_handle,
- const IPC::NavigationInfo& navigation_info) {}
- virtual void OnNavigationFailed(int tab_handle, int error_code,
- const GURL& gurl) {}
- virtual void OnLoad(int tab_handle, const GURL& url) {}
- virtual void OnMessageFromChromeFrame(int tab_handle,
- const std::string& message,
+ virtual void OnNavigationStateChanged(
+ int flags, const NavigationInfo& nav_info) {}
+ virtual void OnUpdateTargetUrl(const std::wstring& new_target_url) {}
+ virtual void OnAcceleratorPressed(const MSG& accel_message) {}
+ virtual void OnTabbedOut(bool reverse) {}
+ virtual void OnOpenURL(
+ const GURL& url, const GURL& referrer, int open_disposition) {}
+ virtual void OnDidNavigate(const NavigationInfo& navigation_info) {}
+ virtual void OnNavigationFailed(int error_code, const GURL& gurl) {}
+ virtual void OnLoad(const GURL& url) {}
+ virtual void OnMessageFromChromeFrame(const std::string& message,
const std::string& origin,
const std::string& target) {}
- virtual void OnHandleContextMenu(int tab_handle, HANDLE menu_handle,
- int align_flags,
- const IPC::MiniContextMenuParams& params) {}
- virtual void OnRequestStart(int tab_handle, int request_id,
- const IPC::AutomationURLRequest& request) {}
- virtual void OnRequestRead(int tab_handle, int request_id,
- int bytes_to_read) {}
- virtual void OnRequestEnd(int tab_handle, int request_id,
- const URLRequestStatus& status) {}
- virtual void OnDownloadRequestInHost(int tab_handle, int request_id) {}
- virtual void OnSetCookieAsync(int tab_handle, const GURL& url,
- const std::string& cookie) {}
- virtual void OnAttachExternalTab(int tab_handle,
- const IPC::AttachExternalTabParams& attach_params) {}
- virtual void OnGoToHistoryEntryOffset(int tab_handle, int offset) {}
-
- virtual void OnGetCookiesFromHost(int tab_handle, const GURL& url,
- int cookie_id) {}
- virtual void OnCloseTab(int tab_handle) {}
+ virtual void OnHandleContextMenu(HANDLE menu_handle, int align_flags,
+ const MiniContextMenuParams& params) {}
+ virtual void OnRequestStart(
+ int request_id, const AutomationURLRequest& request) {}
+ virtual void OnRequestRead(int request_id, int bytes_to_read) {}
+ virtual void OnRequestEnd(int request_id, const URLRequestStatus& status) {}
+ virtual void OnDownloadRequestInHost(int request_id) {}
+ virtual void OnSetCookieAsync(const GURL& url, const std::string& cookie) {}
+ virtual void OnAttachExternalTab(
+ const AttachExternalTabParams& attach_params) {}
+ virtual void OnGoToHistoryEntryOffset(int offset) {}
+
+ virtual void OnGetCookiesFromHost(const GURL& url, int cookie_id) {}
+ virtual void OnCloseTab() {}
};
// This interface enables tasks to be marshaled to desired threads.
diff --git a/chrome_frame/chrome_frame_npapi.cc b/chrome_frame/chrome_frame_npapi.cc
index c36c1b7..a010fac 100644
--- a/chrome_frame/chrome_frame_npapi.cc
+++ b/chrome_frame/chrome_frame_npapi.cc
@@ -901,7 +901,7 @@ void ChromeFrameNPAPI::OnAutomationServerLaunchFailed(
}
}
-void ChromeFrameNPAPI::OnCloseTab(int tab_handle) {
+void ChromeFrameNPAPI::OnCloseTab() {
std::string arg;
FireEvent("close", arg);
ScopedNpVariant result;
@@ -1487,8 +1487,8 @@ bool ChromeFrameNPAPI::PreProcessContextMenu(HMENU menu) {
return true;
}
-bool ChromeFrameNPAPI::HandleContextMenuCommand(UINT cmd,
- const IPC::MiniContextMenuParams& params) {
+bool ChromeFrameNPAPI::HandleContextMenuCommand(
+ UINT cmd, const MiniContextMenuParams& params) {
if (cmd == IDC_ABOUT_CHROME_FRAME) {
// TODO: implement "About Chrome Frame"
}
diff --git a/chrome_frame/chrome_frame_npapi.h b/chrome_frame/chrome_frame_npapi.h
index f05185c..5f78ef7 100644
--- a/chrome_frame/chrome_frame_npapi.h
+++ b/chrome_frame/chrome_frame_npapi.h
@@ -129,8 +129,7 @@ END_MSG_MAP()
static void InitializeIdentifiers();
bool PreProcessContextMenu(HMENU menu);
- bool HandleContextMenuCommand(UINT cmd,
- const IPC::MiniContextMenuParams& params);
+ bool HandleContextMenuCommand(UINT cmd, const MiniContextMenuParams& params);
protected:
// Handler for accelerator messages passed on from the hosted chrome
// instance.
@@ -153,7 +152,7 @@ END_MSG_MAP()
virtual void OnGetEnabledExtensionsComplete(
void* user_data,
const std::vector<FilePath>& extension_directories);
- virtual void OnCloseTab(int tab_handle);
+ virtual void OnCloseTab();
private:
void SubscribeToFocusEvents();
diff --git a/chrome_frame/chrome_frame_plugin.h b/chrome_frame/chrome_frame_plugin.h
index 7acda3c..4f543b5 100644
--- a/chrome_frame/chrome_frame_plugin.h
+++ b/chrome_frame/chrome_frame_plugin.h
@@ -114,14 +114,13 @@ END_MSG_MAP()
}
protected:
- virtual void OnNavigationFailed(int tab_handle, int error_code,
- const GURL& gurl) {
+ virtual void OnNavigationFailed(int error_code, const GURL& gurl) {
OnLoadFailed(error_code, gurl.spec());
}
- virtual void OnHandleContextMenu(int tab_handle, HANDLE menu_handle,
+ virtual void OnHandleContextMenu(HANDLE menu_handle,
int align_flags,
- const IPC::MiniContextMenuParams& params) {
+ const MiniContextMenuParams& params) {
if (!menu_handle || !automation_client_.get()) {
NOTREACHED();
return;
@@ -220,7 +219,7 @@ END_MSG_MAP()
// Return true if menu command is processed, otherwise the command will be
// passed to Chrome for execution. Override in most-derived class if needed.
bool HandleContextMenuCommand(UINT cmd,
- const IPC::MiniContextMenuParams& params) {
+ const MiniContextMenuParams& params) {
return false;
}
diff --git a/chrome_frame/external_tab.cc b/chrome_frame/external_tab.cc
index 785b189..99477ef 100644
--- a/chrome_frame/external_tab.cc
+++ b/chrome_frame/external_tab.cc
@@ -34,6 +34,35 @@ ExternalTabProxy::~ExternalTabProxy() {
Destroy();
}
+void ExternalTabProxy::OnMessageReceived(const IPC::Message& message) {
+ IPC_BEGIN_MESSAGE_MAP(ExternalTabProxy, message)
+ IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged,
+ OnNavigationStateChanged)
+ IPC_MESSAGE_HANDLER(AutomationMsg_UpdateTargetUrl, OnUpdateTargetUrl)
+ IPC_MESSAGE_HANDLER(AutomationMsg_HandleAccelerator, OnHandleAccelerator)
+ IPC_MESSAGE_HANDLER(AutomationMsg_TabbedOut, OnTabbedOut)
+ IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL)
+ IPC_MESSAGE_HANDLER(AutomationMsg_NavigationFailed, OnNavigationFailed)
+ IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate)
+ IPC_MESSAGE_HANDLER(AutomationMsg_TabLoaded, OnTabLoaded)
+ IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost,
+ OnMessageToHost)
+ IPC_MESSAGE_HANDLER(AutomationMsg_ForwardContextMenuToExternalHost,
+ OnHandleContextMenu)
+ IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnNetwork_Start)
+ IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnNetwork_Read)
+ IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnNetwork_End)
+ IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost,
+ OnNetwork_DownloadInHost)
+ IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookies)
+ IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookie)
+ IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachTab)
+ IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset,
+ OnGoToHistoryOffset)
+ IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnTabClosed)
+ IPC_END_MESSAGE_MAP()
+}
+
void ExternalTabProxy::Init() {
if (m_hWnd == NULL) {
// Create a window on the UI thread for marshaling messages back and forth
@@ -88,7 +117,7 @@ void ExternalTabProxy::Connected(ChromeProxy* proxy) {
void ExternalTabProxy::UiConnected(ChromeProxy* proxy) {
proxy_ = proxy;
- IPC::ExternalTabSettings settings;
+ ExternalTabSettings settings;
settings.parent = m_hWnd;
settings.style = WS_CHILD;
settings.is_off_the_record = tab_params_.is_incognito;
@@ -222,122 +251,126 @@ void ExternalTabProxy::Completed_CreateTab(bool success, HWND chrome_wnd,
success, chrome_wnd, tab_window, tab_handle, session_id));
}
-void ExternalTabProxy::Completed_ConnectToTab(bool success,
- HWND chrome_window, HWND tab_window, int tab_handle, int session_id) {
+void ExternalTabProxy::Completed_ConnectToTab(
+ bool success, HWND chrome_window, HWND tab_window, int tab_handle,
+ int session_id) {
CHECK(0);
}
-void ExternalTabProxy::Completed_Navigate(bool success,
- enum AutomationMsg_NavigationResponseValues res) {
+void ExternalTabProxy::Completed_Navigate(
+ bool success, enum AutomationMsg_NavigationResponseValues res) {
// ipc_thread;
CHECK(0);
}
-void ExternalTabProxy::Completed_InstallExtension(bool success,
- enum AutomationMsg_ExtensionResponseValues res, SyncMessageContext* ctx) {
+void ExternalTabProxy::Completed_InstallExtension(
+ bool success, enum AutomationMsg_ExtensionResponseValues res,
+ SyncMessageContext* ctx) {
CHECK(0);
}
-void ExternalTabProxy::Completed_LoadExpandedExtension(bool success,
- enum AutomationMsg_ExtensionResponseValues res, SyncMessageContext* ctx) {
+void ExternalTabProxy::Completed_LoadExpandedExtension(
+ bool success, enum AutomationMsg_ExtensionResponseValues res,
+ SyncMessageContext* ctx) {
CHECK(0);
}
-void ExternalTabProxy::Completed_GetEnabledExtensions(bool success,
- const std::vector<FilePath>* extensions) {
+void ExternalTabProxy::Completed_GetEnabledExtensions(
+ bool success, const std::vector<FilePath>* extensions) {
CHECK(0);
}
-void ExternalTabProxy::NavigationStateChanged(int flags,
- const IPC::NavigationInfo& nav_info) {
+void ExternalTabProxy::OnNavigationStateChanged(
+ int flags, const NavigationInfo& nav_info) {
ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_,
&UIDelegate::OnNavigationStateChanged, flags, nav_info));
}
-void ExternalTabProxy::UpdateTargetUrl(const std::wstring& url) {
+void ExternalTabProxy::OnUpdateTargetUrl(const std::wstring& url) {
ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_,
&UIDelegate::OnUpdateTargetUrl, url));
}
-void ExternalTabProxy::TabLoaded(const GURL& url) {
+void ExternalTabProxy::OnTabLoaded(const GURL& url) {
ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_,
&UIDelegate::OnLoad, url));
}
-void ExternalTabProxy::MessageToHost(const std::string& message,
- const std::string& origin,
- const std::string& target) {
+void ExternalTabProxy::OnMessageToHost(const std::string& message,
+ const std::string& origin,
+ const std::string& target) {
ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_,
&UIDelegate::OnMessageFromChromeFrame, message, origin, target));
}
-void ExternalTabProxy::HandleAccelerator(const MSG& accel_message) {
+void ExternalTabProxy::OnHandleAccelerator(const MSG& accel_message) {
ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_,
&UIDelegate::OnHandleAccelerator, accel_message));
}
-void ExternalTabProxy::HandleContextMenu(
+void ExternalTabProxy::OnHandleContextMenu(
HANDLE menu_handle,
int align_flags,
- const IPC::MiniContextMenuParams& params) {
+ const MiniContextMenuParams& params) {
ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_,
&UIDelegate::OnHandleContextMenu, menu_handle, align_flags, params));
}
-void ExternalTabProxy::TabbedOut(bool reverse) {
+void ExternalTabProxy::OnTabbedOut(bool reverse) {
ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_,
&UIDelegate::OnTabbedOut, reverse));
}
-void ExternalTabProxy::GoToHistoryOffset(int offset) {
+void ExternalTabProxy::OnGoToHistoryOffset(int offset) {
ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_,
&UIDelegate::OnGoToHistoryOffset, offset));
}
-void ExternalTabProxy::OpenURL(const GURL& url_to_open, const GURL& referrer,
- int open_disposition) {
+void ExternalTabProxy::OnOpenURL(const GURL& url_to_open, const GURL& referrer,
+ int open_disposition) {
ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_,
&UIDelegate::OnOpenURL, url_to_open, referrer, open_disposition));
}
-void ExternalTabProxy::NavigationFailed(int error_code, const GURL& gurl) {
+void ExternalTabProxy::OnNavigationFailed(int error_code, const GURL& gurl) {
// TODO(stoyan):
}
-void ExternalTabProxy::DidNavigate(const IPC::NavigationInfo& navigation_info) {
+void ExternalTabProxy::OnDidNavigate(const NavigationInfo& navigation_info) {
// TODO(stoyan):
}
-void ExternalTabProxy::Network_Start(
- int request_id, const IPC::AutomationURLRequest& request_info) {
+void ExternalTabProxy::OnNetwork_Start(
+ int request_id, const AutomationURLRequest& request_info) {
// TODO(stoyan): url_fetcher_.Start();
}
-void ExternalTabProxy::Network_Read(int request_id, int bytes_to_read) {
+void ExternalTabProxy::OnNetwork_Read(int request_id, int bytes_to_read) {
// TODO(stoyan): url_fetcher_.Read();
}
-void ExternalTabProxy::Network_End(int request_id, const URLRequestStatus& s) {
+void ExternalTabProxy::OnNetwork_End(int request_id,
+ const URLRequestStatus& s) {
// TODO(stoyan):
}
-void ExternalTabProxy::Network_DownloadInHost(int request_id) {
+void ExternalTabProxy::OnNetwork_DownloadInHost(int request_id) {
// TODO(stoyan):
}
-void ExternalTabProxy::GetCookies(const GURL& url, int cookie_id) {
+void ExternalTabProxy::OnGetCookies(const GURL& url, int cookie_id) {
// TODO(stoyan):
}
-void ExternalTabProxy::SetCookie(const GURL& url, const std::string& cookie) {
+void ExternalTabProxy::OnSetCookie(const GURL& url, const std::string& cookie) {
// TODO(stoyan):
}
-void ExternalTabProxy::TabClosed() {
+void ExternalTabProxy::OnTabClosed() {
// TODO(stoyan):
}
-void ExternalTabProxy::AttachTab(
- const IPC::AttachExternalTabParams& attach_params) {
+void ExternalTabProxy::OnAttachTab(
+ const AttachExternalTabParams& attach_params) {
// TODO(stoyan):
}
diff --git a/chrome_frame/external_tab.h b/chrome_frame/external_tab.h
index 469d2d7..c3dcbab 100644
--- a/chrome_frame/external_tab.h
+++ b/chrome_frame/external_tab.h
@@ -36,21 +36,23 @@ namespace IPC {
// by the customers of ExternalTabProxy class.
class UIDelegate {
public:
- virtual void OnNavigationStateChanged(int flags,
- const IPC::NavigationInfo& nav_info) = 0;
+ virtual void OnNavigationStateChanged(
+ int flags, const NavigationInfo& nav_info) = 0;
virtual void OnUpdateTargetUrl(const std::wstring& new_target_url) = 0;
virtual void OnExtensionInstalled(const FilePath& path, void* user_data,
AutomationMsg_ExtensionResponseValues response) = 0;
virtual void OnLoad(const GURL& url) = 0;
- virtual void OnMessageFromChromeFrame(const std::string& message,
- const std::string& origin, const std::string& target) = 0;
- virtual void OnHandleContextMenu(HANDLE menu_handle, int align_flags,
- const IPC::MiniContextMenuParams& params) = 0;
+ virtual void OnMessageFromChromeFrame(
+ const std::string& message, const std::string& origin,
+ const std::string& target) = 0;
+ virtual void OnHandleContextMenu(
+ HANDLE menu_handle, int align_flags,
+ const MiniContextMenuParams& params) = 0;
virtual void OnHandleAccelerator(const MSG& accel_message) = 0;
virtual void OnTabbedOut(bool reverse) = 0;
virtual void OnGoToHistoryOffset(int offset) = 0;
- virtual void OnOpenURL(const GURL& url_to_open, const GURL& referrer,
- int open_disposition) = 0;
+ virtual void OnOpenURL(
+ const GURL& url_to_open, const GURL& referrer, int open_disposition) = 0;
protected:
~UIDelegate() {}
};
@@ -90,6 +92,10 @@ class ExternalTabProxy : public CWindowImpl<ExternalTabProxy>,
proxy_factory_ = factory;
}
#endif
+
+ // IPC::Channel::Listener implementation.
+ void OnMessageReceived(const IPC::Message& message);
+
//
virtual void CreateTab(const CreateTabParams& create_params,
UIDelegate* delegate);
@@ -126,7 +132,6 @@ class ExternalTabProxy : public CWindowImpl<ExternalTabProxy>,
virtual void PeerLost(ChromeProxy* proxy, DisconnectReason reason);
virtual void Disconnected();
-
// Sync message responses.
virtual void Completed_CreateTab(bool success, HWND chrome_wnd,
HWND tab_window, int tab_handle, int session_id);
@@ -142,37 +147,38 @@ class ExternalTabProxy : public CWindowImpl<ExternalTabProxy>,
const std::vector<FilePath>* extensions);
// Network requests from Chrome.
- virtual void Network_Start(int request_id,
- const IPC::AutomationURLRequest& request_info);
- virtual void Network_Read(int request_id, int bytes_to_read);
- virtual void Network_End(int request_id, const URLRequestStatus& s);
- virtual void Network_DownloadInHost(int request_id);
- virtual void GetCookies(const GURL& url, int cookie_id);
- virtual void SetCookie(const GURL& url, const std::string& cookie);
+ virtual void OnNetwork_Start(
+ int request_id, const AutomationURLRequest& request_info);
+ virtual void OnNetwork_Read(int request_id, int bytes_to_read);
+ virtual void OnNetwork_End(int request_id, const URLRequestStatus& s);
+ virtual void OnNetwork_DownloadInHost(int request_id);
+ virtual void OnGetCookies(const GURL& url, int cookie_id);
+ virtual void OnSetCookie(const GURL& url, const std::string& cookie);
// Navigation progress notifications.
- virtual void NavigationStateChanged(int flags,
- const IPC::NavigationInfo& nav_info);
- virtual void UpdateTargetUrl(const std::wstring& url);
- virtual void NavigationFailed(int error_code, const GURL& gurl);
- virtual void DidNavigate(const IPC::NavigationInfo& navigation_info);
- virtual void TabLoaded(const GURL& url);
-
- virtual void OpenURL(const GURL& url_to_open, const GURL& referrer,
- int open_disposition);
- virtual void GoToHistoryOffset(int offset);
- virtual void MessageToHost(const std::string& message,
- const std::string& origin, const std::string& target);
+ virtual void OnNavigationStateChanged(
+ int flags, const NavigationInfo& nav_info);
+ virtual void OnUpdateTargetUrl(const std::wstring& url);
+ virtual void OnNavigationFailed(int error_code, const GURL& gurl);
+ virtual void OnDidNavigate(const NavigationInfo& navigation_info);
+ virtual void OnTabLoaded(const GURL& url);
+
+ virtual void OnOpenURL(const GURL& url_to_open, const GURL& referrer,
+ int open_disposition);
+ virtual void OnGoToHistoryOffset(int offset);
+ virtual void OnMessageToHost(
+ const std::string& message, const std::string& origin,
+ const std::string& target);
// Misc. UI.
- virtual void HandleAccelerator(const MSG& accel_message);
- virtual void HandleContextMenu(HANDLE menu_handle, int align_flags,
- const IPC::MiniContextMenuParams& params);
- virtual void TabbedOut(bool reverse);
+ virtual void OnHandleAccelerator(const MSG& accel_message);
+ virtual void OnHandleContextMenu(HANDLE menu_handle, int align_flags,
+ const MiniContextMenuParams& params);
+ virtual void OnTabbedOut(bool reverse);
// Other
- virtual void TabClosed();
- virtual void AttachTab(const IPC::AttachExternalTabParams& attach_params);
+ virtual void OnTabClosed();
+ virtual void OnAttachTab(const AttachExternalTabParams& attach_params);
// end of ChromeProxyDelegate methods
//////////////////////////////////////////////////////////////////////////
diff --git a/chrome_frame/external_tab_test.cc b/chrome_frame/external_tab_test.cc
index ac3359c..f44ce39 100644
--- a/chrome_frame/external_tab_test.cc
+++ b/chrome_frame/external_tab_test.cc
@@ -34,7 +34,7 @@ using chrome_frame_test::TimedMsgLoop;
struct MockUIDelegate : public UIDelegate {
MOCK_METHOD2(OnNavigationStateChanged, void(int flags,
- const IPC::NavigationInfo& nav_info));
+ const NavigationInfo& nav_info));
MOCK_METHOD1(OnUpdateTargetUrl, void(const std::wstring& new_target_url));
MOCK_METHOD3(OnExtensionInstalled, void(const FilePath& path, void* user_data,
AutomationMsg_ExtensionResponseValues response));
@@ -42,7 +42,7 @@ struct MockUIDelegate : public UIDelegate {
MOCK_METHOD3(OnMessageFromChromeFrame, void(const std::string& message,
const std::string& origin, const std::string& target));
MOCK_METHOD3(OnHandleContextMenu, void(HANDLE menu_handle, int align_flags,
- const IPC::MiniContextMenuParams& params));
+ const MiniContextMenuParams& params));
MOCK_METHOD1(OnHandleAccelerator, void(const MSG& accel_message));
MOCK_METHOD1(OnTabbedOut, void(bool reverse));
MOCK_METHOD1(OnGoToHistoryOffset, void(int offset));
@@ -61,7 +61,7 @@ struct MockProxy : public ChromeProxy {
MOCK_METHOD1(SetProxyConfig, void(const std::string& json_encoded_settings));
MOCK_METHOD2(CreateTab, void(ChromeProxyDelegate* delegate,
- const IPC::ExternalTabSettings& settings));
+ const ExternalTabSettings& settings));
MOCK_METHOD3(ConnectTab, void(ChromeProxyDelegate* delegate, HWND hwnd,
uint64 cookie));
MOCK_METHOD1(BlockTab, void(uint64 cookie));
@@ -141,11 +141,6 @@ struct AsyncEventCreator {
tab_window, tab_handle, session_id), delay.InMilliseconds());
}
- void Fire_TabLoaded(const GURL& url, base::TimeDelta delay) {
- ipc_loop_->PostDelayedTask(FROM_HERE, NewRunnableMethod(delegate_,
- &ChromeProxyDelegate::TabLoaded, url), delay.InMilliseconds());
- }
-
private:
ChromeProxyDelegate* delegate_;
base::Thread ipc_thread_;
@@ -191,59 +186,3 @@ TEST(ExternalTabProxy, CancelledCreateTab) {
EXPECT_FALSE(loop.WasTimedOut());
tab.reset();
}
-
-// CreateTab with initial url, and the navigate to different url before
-// initialization completes.
-TEST(ExternalTabProxy, NavigateAfterCreate) {
- MockUIDelegate ui_delegate;
- StrictMock<MockFactory> factory;
- scoped_ptr<ExternalTabProxy> tab(new ExternalTabProxy());
- AsyncEventCreator async_events(tab.get());
- StrictMock<MockProxy>* proxy = new StrictMock<MockProxy>();
- TimedMsgLoop loop;
- tab->set_proxy_factory(&factory);
- GURL initial_url("http://Xanadu.org");
- GURL real_url("http://asgard.org");
-
- EXPECT_CALL(factory, CreateProxy()).WillOnce(Return(proxy));
- EXPECT_CALL(*proxy, Init(_));
- EXPECT_CALL(*proxy, AddDelegate(tab.get()))
- .WillOnce(DoAll(InvokeWithoutArgs(CreateFunctor(&async_events,
- &AsyncEventCreator::Fire_Connected, proxy,
- base::TimeDelta::FromMilliseconds(30))),
- Return(1)));
-
- EXPECT_CALL(*proxy, CreateTab(tab.get(),
- Field(&IPC::ExternalTabSettings::initial_url, real_url)))
- .WillOnce(DoAll(
- InvokeWithoutArgs(CreateFunctor(&async_events,
- &AsyncEventCreator::Fire_CompletedCreateTab,
- true, HWND(0), HWND(0), 7, 0, base::TimeDelta::FromMilliseconds(9))),
- InvokeWithoutArgs(CreateFunctor(&async_events,
- &AsyncEventCreator::Fire_TabLoaded, real_url,
- base::TimeDelta::FromMilliseconds(150)))));
-
- EXPECT_CALL(ui_delegate, OnLoad(real_url))
- .WillOnce(QUIT_LOOP(loop));
-
- EXPECT_CALL(*proxy, RemoveDelegate(_))
- .WillOnce(DoAll(InvokeWithoutArgs(CreateFunctor(&async_events,
- &AsyncEventCreator::Fire_Disconnected,
- base::TimeDelta::FromMilliseconds(0))),
- Return(0)));
-
- CreateTabParams tab_params;
- tab_params.is_incognito = true;
- tab_params.is_widget_mode = false;
- tab_params.url = initial_url;
-
- NavigationConstraintsImpl navigation_constraints;
-
- tab->CreateTab(tab_params, &ui_delegate);
- tab->Navigate("http://asgard.org", EmptyString(),
- &navigation_constraints);
-
- loop.RunFor(5);
- EXPECT_FALSE(loop.WasTimedOut());
- tab.reset();
-}
diff --git a/chrome_frame/npapi_url_request.cc b/chrome_frame/npapi_url_request.cc
index 878f0ed6..1d57065 100644
--- a/chrome_frame/npapi_url_request.cc
+++ b/chrome_frame/npapi_url_request.cc
@@ -215,7 +215,7 @@ PluginUrlRequestManager::ThreadSafeFlags
}
void NPAPIUrlRequestManager::StartRequest(int request_id,
- const IPC::AutomationURLRequest& request_info) {
+ const AutomationURLRequest& request_info) {
scoped_refptr<NPAPIUrlRequest> new_request(new NPAPIUrlRequest(instance_));
DCHECK(new_request);
if (new_request->Initialize(this, request_id, request_info.url,
diff --git a/chrome_frame/npapi_url_request.h b/chrome_frame/npapi_url_request.h
index 3c29c73..a257faf 100644
--- a/chrome_frame/npapi_url_request.h
+++ b/chrome_frame/npapi_url_request.h
@@ -36,7 +36,7 @@ class NPAPIUrlRequestManager : public PluginUrlRequestManager,
// PluginUrlRequestManager implementation. Called from AutomationClient.
virtual PluginUrlRequestManager::ThreadSafeFlags GetThreadSafeFlags();
virtual void StartRequest(int request_id,
- const IPC::AutomationURLRequest& request_info);
+ const AutomationURLRequest& request_info);
virtual void ReadRequest(int request_id, int bytes_to_read);
virtual void EndRequest(int request_id);
virtual void DownloadRequestInHost(int request_id) {
@@ -69,4 +69,3 @@ class NPAPIUrlRequestManager : public PluginUrlRequestManager,
};
#endif // CHROME_FRAME_NPAPI_URL_REQUEST_H_
-
diff --git a/chrome_frame/plugin_url_request.h b/chrome_frame/plugin_url_request.h
index 2d25b94..a39cf7d 100644
--- a/chrome_frame/plugin_url_request.h
+++ b/chrome_frame/plugin_url_request.h
@@ -68,20 +68,20 @@ class DECLSPEC_NOVTABLE PluginUrlRequestManager { // NOLINT
// automation messages are received from Chrome.
// Strip 'tab' handle and forward to the virtual methods implemented by
// derived classes.
- void StartUrlRequest(int tab, int request_id,
- const IPC::AutomationURLRequest& request_info) {
+ void StartUrlRequest(int request_id,
+ const AutomationURLRequest& request_info) {
StartRequest(request_id, request_info);
}
- void ReadUrlRequest(int tab, int request_id, int bytes_to_read) {
+ void ReadUrlRequest(int request_id, int bytes_to_read) {
ReadRequest(request_id, bytes_to_read);
}
- void EndUrlRequest(int tab, int request_id, const URLRequestStatus& s) {
+ void EndUrlRequest(int request_id, const URLRequestStatus& s) {
EndRequest(request_id);
}
- void DownloadUrlRequestInHost(int tab, int request_id) {
+ void DownloadUrlRequestInHost(int request_id) {
DownloadRequestInHost(request_id);
}
@@ -89,12 +89,11 @@ class DECLSPEC_NOVTABLE PluginUrlRequestManager { // NOLINT
StopAll();
}
- void GetCookiesFromHost(int tab_handle, const GURL& url, int cookie_id) {
+ void GetCookiesFromHost(const GURL& url, int cookie_id) {
GetCookiesForUrl(url, cookie_id);
}
- void SetCookiesInHost(int tab_handle, const GURL& url,
- const std::string& cookie) {
+ void SetCookiesInHost(const GURL& url, const std::string& cookie) {
SetCookiesForUrl(url, cookie);
}
@@ -103,8 +102,8 @@ class DECLSPEC_NOVTABLE PluginUrlRequestManager { // NOLINT
bool enable_frame_busting_;
private:
- virtual void StartRequest(int request_id,
- const IPC::AutomationURLRequest& request_info) = 0;
+ virtual void StartRequest(
+ int request_id, const AutomationURLRequest& request_info) = 0;
virtual void ReadRequest(int request_id, int bytes_to_read) = 0;
virtual void EndRequest(int request_id) = 0;
virtual void DownloadRequestInHost(int request_id) = 0;
diff --git a/chrome_frame/test/automation_client_mock.cc b/chrome_frame/test/automation_client_mock.cc
index e4bdad0..7265e10 100644
--- a/chrome_frame/test/automation_client_mock.cc
+++ b/chrome_frame/test/automation_client_mock.cc
@@ -170,18 +170,18 @@ TEST(CFACWithChrome, NavigateOk) {
EXPECT_CALL(cfd, GetBounds(_)).Times(testing::AnyNumber());
- EXPECT_CALL(cfd, OnNavigationStateChanged(_, _))
+ EXPECT_CALL(cfd, OnNavigationStateChanged(_))
.Times(testing::AnyNumber());
{
testing::InSequence s;
- EXPECT_CALL(cfd, OnDidNavigate(_, EqNavigationInfoUrl(GURL())))
+ EXPECT_CALL(cfd, OnDidNavigate(EqNavigationInfoUrl(GURL())))
.Times(1);
- EXPECT_CALL(cfd, OnUpdateTargetUrl(_, _)).Times(testing::AtMost(1));
+ EXPECT_CALL(cfd, OnUpdateTargetUrl(_)).Times(testing::AtMost(1));
- EXPECT_CALL(cfd, OnLoad(_, _))
+ EXPECT_CALL(cfd, OnLoad(_))
.Times(1)
.WillOnce(QUIT_LOOP(loop));
}
@@ -218,18 +218,18 @@ TEST(CFACWithChrome, NavigateFailed) {
url, std::string(), &navigation_constraints))));
EXPECT_CALL(cfd, GetBounds(_)).Times(testing::AnyNumber());
- EXPECT_CALL(cfd, OnNavigationStateChanged(_, _)).Times(testing::AnyNumber());
+ EXPECT_CALL(cfd, OnNavigationStateChanged(_)).Times(testing::AnyNumber());
- EXPECT_CALL(cfd, OnRequestStart(_, _, _))
+ EXPECT_CALL(cfd, OnRequestStart(_, _))
// Often there's another request for the error page
.Times(testing::Between(1, 2))
- .WillRepeatedly(testing::WithArgs<1>(testing::Invoke(CreateFunctor(&cfd,
+ .WillRepeatedly(testing::WithArgs<0>(testing::Invoke(CreateFunctor(&cfd,
&MockCFDelegate::Reply, connection_failed))));
- EXPECT_CALL(cfd, OnUpdateTargetUrl(_, _)).Times(testing::AnyNumber());
- EXPECT_CALL(cfd, OnLoad(_, _)).Times(testing::AtMost(1));
+ EXPECT_CALL(cfd, OnUpdateTargetUrl(_)).Times(testing::AnyNumber());
+ EXPECT_CALL(cfd, OnLoad(_)).Times(testing::AtMost(1));
- EXPECT_CALL(cfd, OnNavigationFailed(_, _, GURL(url)))
+ EXPECT_CALL(cfd, OnNavigationFailed(_, GURL(url)))
.Times(1)
.WillOnce(QUIT_LOOP_SOON(loop, 2));
diff --git a/chrome_frame/test/automation_client_mock.h b/chrome_frame/test/automation_client_mock.h
index 58928b8..4a25b10c 100644
--- a/chrome_frame/test/automation_client_mock.h
+++ b/chrome_frame/test/automation_client_mock.h
@@ -33,32 +33,28 @@ struct MockCFDelegate : public ChromeFrameDelegateImpl {
// MOCK_METHOD1(OnMessageReceived, void(const IPC::Message&));
MOCK_METHOD0(OnChannelError, void(void));
- MOCK_METHOD2(OnNavigationStateChanged, void(int tab_handle, int flags));
- MOCK_METHOD2(OnUpdateTargetUrl, void(int tab_handle,
+ MOCK_METHOD1(OnNavigationStateChanged, void(int flags));
+ MOCK_METHOD1(OnUpdateTargetUrl, void(
const std::wstring& new_target_url));
- MOCK_METHOD2(OnAcceleratorPressed, void(int tab_handle,
- const MSG& accel_message));
- MOCK_METHOD2(OnTabbedOut, void(int tab_handle, bool reverse));
- MOCK_METHOD3(OnOpenURL, void(int tab_handle, const GURL& url,
- int open_disposition));
- MOCK_METHOD2(OnDidNavigate, void(int tab_handle,
- const IPC::NavigationInfo& navigation_info));
- MOCK_METHOD3(OnNavigationFailed, void(int tab_handle, int error_code,
- const GURL& gurl));
- MOCK_METHOD2(OnLoad, void(int tab_handle, const GURL& url));
- MOCK_METHOD4(OnMessageFromChromeFrame, void(int tab_handle,
+ MOCK_METHOD1(OnAcceleratorPressed, void(const MSG& accel_message));
+ MOCK_METHOD1(OnTabbedOut, void(bool reverse));
+ MOCK_METHOD2(OnOpenURL, void(const GURL& url, int open_disposition));
+ MOCK_METHOD1(OnDidNavigate, void(
+ const NavigationInfo& navigation_info));
+ MOCK_METHOD2(OnNavigationFailed, void(int error_code, const GURL& gurl));
+ MOCK_METHOD1(OnLoad, void(const GURL& url));
+ MOCK_METHOD3(OnMessageFromChromeFrame, void(
const std::string& message,
const std::string& origin,
const std::string& target));
- MOCK_METHOD4(OnHandleContextMenu, void(int tab_handle, HANDLE menu_handle,
- int align_flags, const IPC::MiniContextMenuParams& params));
- MOCK_METHOD3(OnRequestStart, void(int tab_handle, int request_id,
- const IPC::AutomationURLRequest& request));
- MOCK_METHOD3(OnRequestRead, void(int tab_handle, int request_id,
- int bytes_to_read));
- MOCK_METHOD3(OnRequestEnd, void(int tab_handle, int request_id,
+ MOCK_METHOD3(OnHandleContextMenu, void(HANDLE menu_handle,
+ int align_flags, const MiniContextMenuParams& params));
+ MOCK_METHOD2(OnRequestStart, void(int request_id,
+ const AutomationURLRequest& request));
+ MOCK_METHOD2(OnRequestRead, void(int request_id, int bytes_to_read));
+ MOCK_METHOD2(OnRequestEnd, void(int request_id,
const URLRequestStatus& status));
- MOCK_METHOD3(OnSetCookieAsync, void(int tab_handle, const GURL& url,
+ MOCK_METHOD2(OnSetCookieAsync, void(const GURL& url,
const std::string& cookie));
// Use for sending network responses
diff --git a/chrome_frame/test/chrome_frame_automation_mock.h b/chrome_frame/test/chrome_frame_automation_mock.h
index 58d9fefa..4ba65e2 100644
--- a/chrome_frame/test/chrome_frame_automation_mock.h
+++ b/chrome_frame/test/chrome_frame_automation_mock.h
@@ -98,7 +98,7 @@ class AutomationMockDelegate
QuitMessageLoop();
}
- virtual void OnLoad(int tab_handle, const GURL& url) {
+ virtual void OnLoad(const GURL& url) {
if (url_ == url) {
navigation_result_ = true;
} else {
@@ -169,8 +169,8 @@ class AutomationMockNavigate
: Base(caller_message_loop, launch_timeout, true, L"", L"", L"", false,
false) {
}
- virtual void OnLoad(int tab_handle, const GURL& url) {
- Base::OnLoad(tab_handle, url);
+ virtual void OnLoad(const GURL& url) {
+ Base::OnLoad(url);
QuitMessageLoop();
}
};
@@ -187,14 +187,13 @@ class AutomationMockPostMessage
bool postmessage_result() const {
return postmessage_result_;
}
- virtual void OnLoad(int tab_handle, const GURL& url) {
- Base::OnLoad(tab_handle, url);
+ virtual void OnLoad(const GURL& url) {
+ Base::OnLoad(url);
if (navigation_result()) {
automation()->ForwardMessageFromExternalHost("Test", "null", "*");
}
}
- virtual void OnMessageFromChromeFrame(int tab_handle,
- const std::string& message,
+ virtual void OnMessageFromChromeFrame(const std::string& message,
const std::string& origin,
const std::string& target) {
postmessage_result_ = true;
@@ -220,13 +219,13 @@ class AutomationMockHostNetworkRequestStart
bool request_start_result() const {
return request_start_result_;
}
- virtual void OnRequestStart(int tab_handle, int request_id,
- const IPC::AutomationURLRequest& request) {
+ virtual void OnRequestStart(int request_id,
+ const AutomationURLRequest& request) {
request_start_result_ = true;
QuitMessageLoop();
}
- virtual void OnLoad(int tab_handle, const GURL& url) {
- Base::OnLoad(tab_handle, url);
+ virtual void OnLoad(const GURL& url) {
+ Base::OnLoad(url);
}
private:
bool request_start_result_;
diff --git a/chrome_frame/test/url_request_test.cc b/chrome_frame/test/url_request_test.cc
index 95b8969..0059571 100644
--- a/chrome_frame/test/url_request_test.cc
+++ b/chrome_frame/test/url_request_test.cc
@@ -240,12 +240,12 @@ TEST(UrlmonUrlRequestTest, ZeroLengthResponse) {
ACTION_P4(ManagerRead, loop, mgr, request_id, bytes_to_read) {
loop->PostDelayedTask(FROM_HERE, NewRunnableMethod(mgr,
- &UrlmonUrlRequestManager::ReadUrlRequest, 0, request_id,
+ &UrlmonUrlRequestManager::ReadUrlRequest, request_id,
bytes_to_read), 0);
}
ACTION_P3(ManagerEndRequest, loop, mgr, request_id) {
loop->PostDelayedTask(FROM_HERE, NewRunnableMethod(mgr,
- &UrlmonUrlRequestManager::EndUrlRequest, 0, request_id,
+ &UrlmonUrlRequestManager::EndUrlRequest, request_id,
URLRequestStatus()), 0);
}
@@ -260,7 +260,7 @@ TEST(UrlmonUrlRequestManagerTest, Simple1) {
scoped_ptr<UrlmonUrlRequestManager> mgr(new UrlmonUrlRequestManager());
mgr->set_delegate(&mock);
- IPC::AutomationURLRequest r1(
+ AutomationURLRequest r1(
WideToUTF8(mock_server.Resolve(L"chrome_frame_window_open.html")),
"get", "", "", NULL, 0, 0);
@@ -278,7 +278,7 @@ TEST(UrlmonUrlRequestManagerTest, Simple1) {
.Times(1)
.WillOnce(QUIT_LOOP_SOON(loop, 2));
- mgr->StartUrlRequest(0, 1, r1);
+ mgr->StartUrlRequest(1, r1);
loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds);
mgr.reset();
}
@@ -293,7 +293,7 @@ TEST(UrlmonUrlRequestManagerTest, Abort1) {
scoped_ptr<UrlmonUrlRequestManager> mgr(new UrlmonUrlRequestManager());
mgr->set_delegate(&mock);
- IPC::AutomationURLRequest r1(
+ AutomationURLRequest r1(
WideToUTF8(mock_server.Resolve(L"chrome_frame_window_open.html")),
"get", "", "", NULL, 0, 0);
@@ -310,7 +310,7 @@ TEST(UrlmonUrlRequestManagerTest, Abort1) {
EXPECT_CALL(mock, OnResponseEnd(1, testing::_))
.Times(0);
- mgr->StartUrlRequest(0, 1, r1);
+ mgr->StartUrlRequest(1, r1);
loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds);
mgr.reset();
}
diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc
index c4a1968..d191515 100644
--- a/chrome_frame/urlmon_url_request.cc
+++ b/chrome_frame/urlmon_url_request.cc
@@ -964,7 +964,7 @@ void UrlmonUrlRequestManager::SetInfoForUrl(const std::wstring& url,
}
void UrlmonUrlRequestManager::StartRequest(int request_id,
- const IPC::AutomationURLRequest& request_info) {
+ const AutomationURLRequest& request_info) {
DVLOG(1) << __FUNCTION__ << " id: " << request_id;
DCHECK_EQ(0, calling_delegate_);
diff --git a/chrome_frame/urlmon_url_request.h b/chrome_frame/urlmon_url_request.h
index 18099fd..dcc0b7b 100644
--- a/chrome_frame/urlmon_url_request.h
+++ b/chrome_frame/urlmon_url_request.h
@@ -82,7 +82,7 @@ class UrlmonUrlRequestManager
// PluginUrlRequestManager implementation.
virtual PluginUrlRequestManager::ThreadSafeFlags GetThreadSafeFlags();
virtual void StartRequest(int request_id,
- const IPC::AutomationURLRequest& request_info);
+ const AutomationURLRequest& request_info);
virtual void ReadRequest(int request_id, int bytes_to_read);
virtual void EndRequest(int request_id);
virtual void DownloadRequestInHost(int request_id);