diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-24 06:19:28 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-24 06:19:28 +0000 |
commit | a95986a837fc86e079b5c6dac357636478b50092 (patch) | |
tree | 66a32009250791e64741216cdd6c21ecf1ff7f86 /chrome_frame | |
parent | 125a7ba65ad10ace9edcf36d6943ce9ae2bdc1d6 (diff) | |
download | chromium_src-a95986a837fc86e079b5c6dac357636478b50092.zip chromium_src-a95986a837fc86e079b5c6dac357636478b50092.tar.gz chromium_src-a95986a837fc86e079b5c6dac357636478b50092.tar.bz2 |
Make IPC::Channel::Listener:OnMessageReceived have a return value indicating whether a message was processed or not.
TBR=brettw
Review URL: http://codereview.chromium.org/5978003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/cfproxy.h | 3 | ||||
-rw-r--r-- | chrome_frame/cfproxy_private.h | 2 | ||||
-rw-r--r-- | chrome_frame/cfproxy_proxy.cc | 5 | ||||
-rw-r--r-- | chrome_frame/cfproxy_test.cc | 3 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_delegate.cc | 8 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_delegate.h | 4 | ||||
-rw-r--r-- | chrome_frame/external_tab.cc | 5 | ||||
-rw-r--r-- | chrome_frame/external_tab.h | 2 | ||||
-rw-r--r-- | chrome_frame/test/net/test_automation_provider.cc | 6 | ||||
-rw-r--r-- | chrome_frame/test/net/test_automation_provider.h | 2 |
10 files changed, 23 insertions, 17 deletions
diff --git a/chrome_frame/cfproxy.h b/chrome_frame/cfproxy.h index ae404b2..b32bf78 100644 --- a/chrome_frame/cfproxy.h +++ b/chrome_frame/cfproxy.h @@ -148,9 +148,6 @@ class ChromeProxyDelegate : public IPC::Channel::Listener { 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; diff --git a/chrome_frame/cfproxy_private.h b/chrome_frame/cfproxy_private.h index 6ec0080..165e231 100644 --- a/chrome_frame/cfproxy_private.h +++ b/chrome_frame/cfproxy_private.h @@ -163,7 +163,7 @@ class CFProxy : public Interface2IPCMessage, ////////////////////////////////////////////////////////////////////////// // IPC::Channel::Listener - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); diff --git a/chrome_frame/cfproxy_proxy.cc b/chrome_frame/cfproxy_proxy.cc index 0f59d8a..46ac821 100644 --- a/chrome_frame/cfproxy_proxy.cc +++ b/chrome_frame/cfproxy_proxy.cc @@ -208,11 +208,11 @@ void CFProxy::Tab_RunUnloadHandlers(int tab) { } // IPC::Channel::Listener -void CFProxy::OnMessageReceived(const IPC::Message& message) { +bool CFProxy::OnMessageReceived(const IPC::Message& message) { // Handle sync message reply. bool done = sync_dispatcher_.OnReplyReceived(&message); if (done) - return; + return true; // Handle tab related message. ChromeProxyDelegate* d = Tab2Delegate(message.routing_id()); @@ -220,6 +220,7 @@ void CFProxy::OnMessageReceived(const IPC::Message& message) { return d->OnMessageReceived(message); DLOG(WARNING) << "Unknown message received!"; + return false; } void CFProxy::OnChannelConnected(int32 peer_pid) { diff --git a/chrome_frame/cfproxy_test.cc b/chrome_frame/cfproxy_test.cc index d6be8b1..46e716d 100644 --- a/chrome_frame/cfproxy_test.cc +++ b/chrome_frame/cfproxy_test.cc @@ -1,3 +1,4 @@ + // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -28,7 +29,7 @@ struct MockFactory : public ChromeProxyFactory { }; struct MockChromeProxyDelegate : public ChromeProxyDelegate { - MOCK_METHOD1(OnMessageReceived, void(const IPC::Message& message)); + MOCK_METHOD1(OnMessageReceived, bool(const IPC::Message& message)); MOCK_METHOD1(Connected, void(ChromeProxy* proxy)); MOCK_METHOD2(PeerLost, void(ChromeProxy*, enum DisconnectReason reason)); MOCK_METHOD0(Disconnected, void()); diff --git a/chrome_frame/chrome_frame_delegate.cc b/chrome_frame/chrome_frame_delegate.cc index cd54c5f..a2e84b6 100644 --- a/chrome_frame/chrome_frame_delegate.cc +++ b/chrome_frame/chrome_frame_delegate.cc @@ -33,13 +33,14 @@ bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message) { return is_tab_message; } -void ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) { +bool ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) { if (!IsValid()) { DLOG(WARNING) << __FUNCTION__ << " Msgs received for a NULL automation client instance"; - return; + return false; } + bool handled = true; IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, msg) IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, OnNavigationStateChanged) @@ -66,5 +67,8 @@ void ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) { OnGoToHistoryEntryOffset) IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookiesFromHost) IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnCloseTab) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + + return handled; } diff --git a/chrome_frame/chrome_frame_delegate.h b/chrome_frame/chrome_frame_delegate.h index 647f0d0..1a0f34b 100644 --- a/chrome_frame/chrome_frame_delegate.h +++ b/chrome_frame/chrome_frame_delegate.h @@ -35,7 +35,7 @@ class ChromeFrameDelegate { virtual void OnGetEnabledExtensionsComplete( void* user_data, const std::vector<FilePath>& extension_directories) = 0; - virtual void OnMessageReceived(const IPC::Message& msg) = 0; + virtual bool OnMessageReceived(const IPC::Message& msg) = 0; virtual void OnChannelError() = 0; // This remains in interface since we call it if Navigate() @@ -76,7 +76,7 @@ class ChromeFrameDelegateImpl : public ChromeFrameDelegate { void* user_data, const std::vector<FilePath>& extension_directories) {} virtual void OnLoadFailed(int error_code, const std::string& url) {} - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError() {} static bool IsTabMessage(const IPC::Message& message); diff --git a/chrome_frame/external_tab.cc b/chrome_frame/external_tab.cc index 99477ef..9be4935 100644 --- a/chrome_frame/external_tab.cc +++ b/chrome_frame/external_tab.cc @@ -34,7 +34,8 @@ ExternalTabProxy::~ExternalTabProxy() { Destroy(); } -void ExternalTabProxy::OnMessageReceived(const IPC::Message& message) { +bool ExternalTabProxy::OnMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(ExternalTabProxy, message) IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, OnNavigationStateChanged) @@ -60,7 +61,9 @@ void ExternalTabProxy::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset, OnGoToHistoryOffset) IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnTabClosed) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void ExternalTabProxy::Init() { diff --git a/chrome_frame/external_tab.h b/chrome_frame/external_tab.h index c3dcbab..4fbb5d3 100644 --- a/chrome_frame/external_tab.h +++ b/chrome_frame/external_tab.h @@ -94,7 +94,7 @@ class ExternalTabProxy : public CWindowImpl<ExternalTabProxy>, #endif // IPC::Channel::Listener implementation. - void OnMessageReceived(const IPC::Message& message); + bool OnMessageReceived(const IPC::Message& message); // virtual void CreateTab(const CreateTabParams& create_params, diff --git a/chrome_frame/test/net/test_automation_provider.cc b/chrome_frame/test/net/test_automation_provider.cc index 4b4d2a1..c015d2b 100644 --- a/chrome_frame/test/net/test_automation_provider.cc +++ b/chrome_frame/test/net/test_automation_provider.cc @@ -48,11 +48,11 @@ TestAutomationProvider::~TestAutomationProvider() { g_provider_instance_ = NULL; } -void TestAutomationProvider::OnMessageReceived(const IPC::Message& msg) { +bool TestAutomationProvider::OnMessageReceived(const IPC::Message& msg) { if (automation_resource_message_filter_->OnMessageReceived(msg)) - return; // Message handled by the filter. + return true; // Message handled by the filter. - __super::OnMessageReceived(msg); + return __super::OnMessageReceived(msg); } // IPC override to grab the tab handle. diff --git a/chrome_frame/test/net/test_automation_provider.h b/chrome_frame/test/net/test_automation_provider.h index bc98b3a..209a069 100644 --- a/chrome_frame/test/net/test_automation_provider.h +++ b/chrome_frame/test/net/test_automation_provider.h @@ -36,7 +36,7 @@ class TestAutomationProvider virtual ~TestAutomationProvider(); // AutomationProvider overrides. - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual bool Send(IPC::Message* msg); // Protocol factory for handling http/https requests over automation. |