| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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_MESSAGE_FILT
ER_H_ | |
| 6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_MESSAGE_FILT
ER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "chrome/browser/search_engines/search_provider_install_data.h" | |
| 11 #include "chrome/common/search_provider.h" | |
| 12 #include "content/public/browser/browser_message_filter.h" | |
| 13 | |
| 14 class GURL; | |
| 15 class Profile; | |
| 16 | |
| 17 // Handles messages regarding search provider install state on the I/O thread. | |
| 18 class SearchProviderInstallStateMessageFilter | |
| 19 : public content::BrowserMessageFilter { | |
| 20 public: | |
| 21 // Unlike the other methods, the constructor must be called on the UI thread. | |
| 22 SearchProviderInstallStateMessageFilter(int render_process_id, | |
| 23 Profile* profile); | |
| 24 | |
| 25 // content::BrowserMessageFilter implementation. | |
| 26 bool OnMessageReceived(const IPC::Message& message) override; | |
| 27 | |
| 28 private: | |
| 29 ~SearchProviderInstallStateMessageFilter() override; | |
| 30 | |
| 31 // Figures out the install state for the search provider. | |
| 32 search_provider::InstallState GetSearchProviderInstallState( | |
| 33 const GURL& page_location, | |
| 34 const GURL& requested_host); | |
| 35 | |
| 36 // Starts handling the message requesting the search provider install state. | |
| 37 void OnGetSearchProviderInstallState(const GURL& page_location, | |
| 38 const GURL& requested_host, | |
| 39 IPC::Message* reply_msg); | |
| 40 | |
| 41 // Sends the reply message about the search provider install state. | |
| 42 void ReplyWithProviderInstallState(const GURL& page_location, | |
| 43 const GURL& requested_host, | |
| 44 IPC::Message* reply_msg); | |
| 45 | |
| 46 // Used to do a load and get information about install states. | |
| 47 SearchProviderInstallData provider_data_; | |
| 48 | |
| 49 // Copied from the profile since the profile can't be accessed on the I/O | |
| 50 // thread. | |
| 51 const bool is_off_the_record_; | |
| 52 | |
| 53 // Used to schedule invocations of ReplyWithProviderInstallState. | |
| 54 base::WeakPtrFactory<SearchProviderInstallStateMessageFilter> weak_factory_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallStateMessageFilter); | |
| 57 }; | |
| 58 | |
| 59 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_MESSAGE_F
ILTER_H_ | |
| OLD | NEW |