| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_DISPATCHER_H
OST_H_ | |
| 6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_DISPATCHER_H
OST_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/scoped_ptr.h" | |
| 10 #include "base/task.h" | |
| 11 #include "chrome/browser/search_engines/search_provider_install_data.h" | |
| 12 | |
| 13 namespace IPC { | |
| 14 class Message; | |
| 15 } | |
| 16 | |
| 17 class GURL; | |
| 18 class Profile; | |
| 19 class ResourceMessageFilter; | |
| 20 struct ViewHostMsg_GetSearchProviderInstallState_Params; | |
| 21 | |
| 22 // Handles messages regarding search provider install state on the I/O thread. | |
| 23 class SearchProviderInstallStateDispatcherHost { | |
| 24 public: | |
| 25 // Unlike the other methods, the constructor is called on the UI thread. | |
| 26 SearchProviderInstallStateDispatcherHost(ResourceMessageFilter* ipc_sender, | |
| 27 Profile* profile, | |
| 28 int render_process_id); | |
| 29 ~SearchProviderInstallStateDispatcherHost(); | |
| 30 | |
| 31 // Send a message to the renderer process. | |
| 32 void Send(IPC::Message* message); | |
| 33 | |
| 34 // Called to possibly handle the incoming IPC message. Returns true if | |
| 35 // handled. | |
| 36 bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok); | |
| 37 | |
| 38 private: | |
| 39 // Figures out the install state for the search provider. | |
| 40 ViewHostMsg_GetSearchProviderInstallState_Params | |
| 41 GetSearchProviderInstallState(const GURL& page_location, | |
| 42 const GURL& requested_host); | |
| 43 | |
| 44 // Starts handling the message requesting the search provider install state. | |
| 45 void OnMsgGetSearchProviderInstallState(const GURL& page_location, | |
| 46 const GURL& requested_host, | |
| 47 IPC::Message* reply_msg); | |
| 48 | |
| 49 // Sends the reply message about the search provider install state. | |
| 50 void ReplyWithProviderInstallState(const GURL& page_location, | |
| 51 const GURL& requested_host, | |
| 52 IPC::Message* reply_msg); | |
| 53 | |
| 54 // Used to schedule invocations of ReplyWithProviderInstallState. | |
| 55 ScopedRunnableMethodFactory<SearchProviderInstallStateDispatcherHost> | |
| 56 reply_with_provider_install_state_factory_; | |
| 57 | |
| 58 // Used to do a load and get information about install states. | |
| 59 SearchProviderInstallData provider_data_; | |
| 60 | |
| 61 // Used to reply to messages. | |
| 62 ResourceMessageFilter* ipc_sender_; | |
| 63 | |
| 64 // Copied from the profile since the profile can't be accessed on the I/O | |
| 65 // thread. | |
| 66 const bool is_off_the_record_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallStateDispatcherHost); | |
| 69 }; | |
| 70 | |
| 71 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_DISPATCHE
R_HOST_H_ | |
| OLD | NEW |