Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Side by Side Diff: chrome/browser/search_engines/search_provider_install_state_impl.h

Issue 2072613003: Convert GetSearchProviderInstallState to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move InstallState enum into mojom Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_MESSAGE_FILT ER_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_IMPL_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_MESSAGE_FILT ER_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_IMPL_H_
7 7
8 #include "base/callback.h"
Sam McNally 2016/06/23 03:05:35 callback_forward.h
tibell 2016/06/23 03:44:39 Done.
8 #include "base/macros.h" 9 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/profiles/profile.h"
Sam McNally 2016/06/23 03:05:35 Remove.
tibell 2016/06/23 03:44:38 Done.
10 #include "chrome/browser/search_engines/search_provider_install_data.h" 12 #include "chrome/browser/search_engines/search_provider_install_data.h"
11 #include "chrome/common/search_provider.h" 13 #include "chrome/common/search_provider.h"
Sam McNally 2016/06/23 03:05:35 Remove.
tibell 2016/06/23 03:44:39 Done.
14 #include "chrome/common/search_provider.mojom.h"
12 #include "content/public/browser/browser_message_filter.h" 15 #include "content/public/browser/browser_message_filter.h"
16 #include "content/public/browser/render_process_host.h"
Sam McNally 2016/06/23 03:05:35 Remove and forward declare RenderProcessHost inste
tibell 2016/06/23 03:44:38 Done.
17 #include "content/public/common/service_registry.h"
Sam McNally 2016/06/23 03:05:35 Move this into the .cc file.
tibell 2016/06/23 03:44:39 Done.
18 #include "mojo/public/cpp/bindings/binding_set.h"
13 19
14 class GURL; 20 class GURL;
15 class Profile; 21 class Profile;
16 22
17 // Handles messages regarding search provider install state on the I/O thread. 23 // Handles messages regarding search provider install state on the I/O thread.
18 class SearchProviderInstallStateMessageFilter 24 class SearchProviderInstallStateImpl
19 : public content::BrowserMessageFilter { 25 : public chrome::mojom::SearchProviderInstallState {
20 public: 26 public:
21 // Unlike the other methods, the constructor must be called on the UI thread. 27 // Unlike the other methods, the constructor must be called on the UI thread.
22 SearchProviderInstallStateMessageFilter(int render_process_id, 28 SearchProviderInstallStateImpl(int render_process_id, Profile* profile);
23 Profile* profile); 29 ~SearchProviderInstallStateImpl() override;
24 30
25 // content::BrowserMessageFilter implementation. 31 // Create impl and register it in the host's service registry.
26 bool OnMessageReceived(const IPC::Message& message) override; 32 static void InstallService(content::RenderProcessHost* host);
27 33
28 private: 34 private:
29 ~SearchProviderInstallStateMessageFilter() override; 35 void Bind(chrome::mojom::SearchProviderInstallStateRequest request);
30 36
31 // Figures out the install state for the search provider. 37 // Figures out the install state for the search provider.
32 search_provider::InstallState GetSearchProviderInstallState( 38 chrome::mojom::InstallState GetSearchProviderInstallState(
33 const GURL& page_location, 39 const GURL& page_location,
34 const GURL& requested_host); 40 const GURL& requested_host);
35 41
36 // Starts handling the message requesting the search provider install state. 42 // Starts handling the message requesting the search provider install state.
37 void OnGetSearchProviderInstallState(const GURL& page_location, 43 // chrome::mojom::SearchProviderInstallState override.
38 const GURL& requested_host, 44 void GetInstallState(const GURL& page_location,
39 IPC::Message* reply_msg); 45 const GURL& requested_host,
46 const GetInstallStateCallback& callback) override;
40 47
41 // Sends the reply message about the search provider install state. 48 // Sends the reply message about the search provider install state.
42 void ReplyWithProviderInstallState(const GURL& page_location, 49 void ReplyWithProviderInstallState(const GURL& page_location,
43 const GURL& requested_host, 50 const GURL& requested_host,
44 IPC::Message* reply_msg); 51 const GetInstallStateCallback& callback);
45 52
46 // Used to do a load and get information about install states. 53 // Used to do a load and get information about install states.
47 SearchProviderInstallData provider_data_; 54 SearchProviderInstallData provider_data_;
48 55
49 // Copied from the profile since the profile can't be accessed on the I/O 56 // Copied from the profile since the profile can't be accessed on the I/O
50 // thread. 57 // thread.
51 const bool is_off_the_record_; 58 const bool is_off_the_record_;
52 59
60 mojo::BindingSet<chrome::mojom::SearchProviderInstallState> binding_set_;
61
53 // Used to schedule invocations of ReplyWithProviderInstallState. 62 // Used to schedule invocations of ReplyWithProviderInstallState.
54 base::WeakPtrFactory<SearchProviderInstallStateMessageFilter> weak_factory_; 63 base::WeakPtrFactory<SearchProviderInstallStateImpl> weak_factory_;
55 64
56 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallStateMessageFilter); 65 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallStateImpl);
57 }; 66 };
58 67
59 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_MESSAGE_F ILTER_H_ 68 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698