summaryrefslogtreecommitdiffstats
path: root/chrome/browser/search_engines
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-13 17:00:42 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-13 17:00:42 +0000
commit9f547bfd7465f0bcb29ab1d0225dddf81e7ebed8 (patch)
treeb9991ef261fb6107a25947da1231c36e70919bd1 /chrome/browser/search_engines
parentdc8caba097e35e536697f3bf6605257317640d26 (diff)
downloadchromium_src-9f547bfd7465f0bcb29ab1d0225dddf81e7ebed8.zip
chromium_src-9f547bfd7465f0bcb29ab1d0225dddf81e7ebed8.tar.gz
chromium_src-9f547bfd7465f0bcb29ab1d0225dddf81e7ebed8.tar.bz2
Switch a bunch of remaining filters to derive from BrowserMessageFilters so that ResourceMessageFilter doesn't have to know about them and vice versa. A bunch of small cleanup in the process. I've added new message files for classes that want their messages dispatched on threads other than the IO.
Review URL: http://codereview.chromium.org/5698008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69008 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines')
-rw-r--r--chrome/browser/search_engines/search_provider_install_state_message_filter.cc (renamed from chrome/browser/search_engines/search_provider_install_state_dispatcher_host.cc)38
-rw-r--r--chrome/browser/search_engines/search_provider_install_state_message_filter.h (renamed from chrome/browser/search_engines/search_provider_install_state_dispatcher_host.h)40
2 files changed, 27 insertions, 51 deletions
diff --git a/chrome/browser/search_engines/search_provider_install_state_dispatcher_host.cc b/chrome/browser/search_engines/search_provider_install_state_message_filter.cc
index b7b990e..a24bc1b 100644
--- a/chrome/browser/search_engines/search_provider_install_state_dispatcher_host.cc
+++ b/chrome/browser/search_engines/search_provider_install_state_message_filter.cc
@@ -2,55 +2,45 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/search_engines/search_provider_install_state_dispatcher_host.h"
+#include "chrome/browser/search_engines/search_provider_install_state_message_filter.h"
#include "base/logging.h"
-#include "chrome/browser/browser_thread.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
-#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/common/notification_source.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
-#include "ipc/ipc_message.h"
#include "googleurl/src/gurl.h"
-SearchProviderInstallStateDispatcherHost::
-SearchProviderInstallStateDispatcherHost(
- ResourceMessageFilter* ipc_sender,
- Profile* profile,
- int render_process_id)
+SearchProviderInstallStateMessageFilter::
+SearchProviderInstallStateMessageFilter(
+ int render_process_id,
+ Profile* profile)
: ALLOW_THIS_IN_INITIALIZER_LIST(
reply_with_provider_install_state_factory_(this)),
provider_data_(profile->GetWebDataService(Profile::EXPLICIT_ACCESS),
NotificationType::RENDERER_PROCESS_TERMINATED,
Source<RenderProcessHost>(
RenderProcessHost::FromID(render_process_id))),
- ipc_sender_(ipc_sender),
is_off_the_record_(profile->IsOffTheRecord()) {
- // This is initialized by ResourceMessageFilter. Do not add any non-trivial
+ // This is initialized by BrowserRenderProcessHost. Do not add any non-trivial
// initialization here. Instead do it lazily when required.
- DCHECK(ipc_sender);
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
}
-SearchProviderInstallStateDispatcherHost::
-~SearchProviderInstallStateDispatcherHost() {
+SearchProviderInstallStateMessageFilter::
+~SearchProviderInstallStateMessageFilter() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
}
-void SearchProviderInstallStateDispatcherHost::Send(IPC::Message* message) {
- ipc_sender_->Send(message);
-}
-
-bool SearchProviderInstallStateDispatcherHost::OnMessageReceived(
+bool SearchProviderInstallStateMessageFilter::OnMessageReceived(
const IPC::Message& message,
bool* message_was_ok) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
bool handled = true;
- IPC_BEGIN_MESSAGE_MAP_EX(SearchProviderInstallStateDispatcherHost, message,
+ IPC_BEGIN_MESSAGE_MAP_EX(SearchProviderInstallStateMessageFilter, message,
*message_was_ok)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetSearchProviderInstallState,
OnMsgGetSearchProviderInstallState)
@@ -60,7 +50,7 @@ bool SearchProviderInstallStateDispatcherHost::OnMessageReceived(
}
ViewHostMsg_GetSearchProviderInstallState_Params
-SearchProviderInstallStateDispatcherHost::GetSearchProviderInstallState(
+SearchProviderInstallStateMessageFilter::GetSearchProviderInstallState(
const GURL& page_location,
const GURL& requested_host) {
GURL requested_origin = requested_host.GetOrigin();
@@ -95,20 +85,20 @@ SearchProviderInstallStateDispatcherHost::GetSearchProviderInstallState(
}
void
-SearchProviderInstallStateDispatcherHost::OnMsgGetSearchProviderInstallState(
+SearchProviderInstallStateMessageFilter::OnMsgGetSearchProviderInstallState(
const GURL& page_location,
const GURL& requested_host,
IPC::Message* reply_msg) {
provider_data_.CallWhenLoaded(
reply_with_provider_install_state_factory_.NewRunnableMethod(
- &SearchProviderInstallStateDispatcherHost::
+ &SearchProviderInstallStateMessageFilter::
ReplyWithProviderInstallState,
page_location,
requested_host,
reply_msg));
}
-void SearchProviderInstallStateDispatcherHost::ReplyWithProviderInstallState(
+void SearchProviderInstallStateMessageFilter::ReplyWithProviderInstallState(
const GURL& page_location,
const GURL& requested_host,
IPC::Message* reply_msg) {
diff --git a/chrome/browser/search_engines/search_provider_install_state_dispatcher_host.h b/chrome/browser/search_engines/search_provider_install_state_message_filter.h
index d597eb4..63ea44e 100644
--- a/chrome/browser/search_engines/search_provider_install_state_dispatcher_host.h
+++ b/chrome/browser/search_engines/search_provider_install_state_message_filter.h
@@ -2,38 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_DISPATCHER_HOST_H_
-#define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_DISPATCHER_HOST_H_
+#ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_MESSAGE_FILTER_H_
+#define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_MESSAGE_FILTER_H_
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/task.h"
+#include "chrome/browser/browser_message_filter.h"
#include "chrome/browser/search_engines/search_provider_install_data.h"
-namespace IPC {
-class Message;
-}
-
class GURL;
class Profile;
-class ResourceMessageFilter;
struct ViewHostMsg_GetSearchProviderInstallState_Params;
// Handles messages regarding search provider install state on the I/O thread.
-class SearchProviderInstallStateDispatcherHost {
+class SearchProviderInstallStateMessageFilter : public BrowserMessageFilter {
public:
// Unlike the other methods, the constructor is called on the UI thread.
- SearchProviderInstallStateDispatcherHost(ResourceMessageFilter* ipc_sender,
- Profile* profile,
- int render_process_id);
- ~SearchProviderInstallStateDispatcherHost();
-
- // Send a message to the renderer process.
- void Send(IPC::Message* message);
+ SearchProviderInstallStateMessageFilter(int render_process_id,
+ Profile* profile);
+ ~SearchProviderInstallStateMessageFilter();
- // Called to possibly handle the incoming IPC message. Returns true if
- // handled.
- bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok);
+ // BrowserMessageFilter implementation.
+ virtual bool OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok);
private:
// Figures out the install state for the search provider.
@@ -52,20 +41,17 @@ class SearchProviderInstallStateDispatcherHost {
IPC::Message* reply_msg);
// Used to schedule invocations of ReplyWithProviderInstallState.
- ScopedRunnableMethodFactory<SearchProviderInstallStateDispatcherHost>
+ ScopedRunnableMethodFactory<SearchProviderInstallStateMessageFilter>
reply_with_provider_install_state_factory_;
// Used to do a load and get information about install states.
SearchProviderInstallData provider_data_;
- // Used to reply to messages.
- ResourceMessageFilter* ipc_sender_;
-
// Copied from the profile since the profile can't be accessed on the I/O
// thread.
const bool is_off_the_record_;
- DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallStateDispatcherHost);
+ DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallStateMessageFilter);
};
-#endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_DISPATCHER_HOST_H_
+#endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_MESSAGE_FILTER_H_