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

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

Issue 2170313002: Remove OwnedInterface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 4 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_IMPL_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_IMPL_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_IMPL_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_IMPL_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/search_engines/search_provider_install_data.h" 11 #include "chrome/browser/search_engines/search_provider_install_data.h"
12 #include "chrome/common/search_provider.mojom.h" 12 #include "chrome/common/search_provider.mojom.h"
13 #include "content/public/browser/browser_message_filter.h" 13 #include "content/public/browser/browser_message_filter.h"
14 #include "mojo/public/cpp/bindings/binding_set.h" 14 #include "mojo/public/cpp/bindings/strong_binding.h"
15 15
16 class GURL; 16 class GURL;
17 class Profile; 17 class Profile;
18 18
19 namespace content { 19 namespace content {
20 class RenderProcessHost; 20 class RenderProcessHost;
21 } // namespace content 21 } // namespace content
22 22
23 // 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.
24 class SearchProviderInstallStateImpl 24 class SearchProviderInstallStateImpl
25 : public chrome::mojom::SearchProviderInstallState { 25 : public chrome::mojom::SearchProviderInstallState {
26 public: 26 public:
27 // 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.
28 SearchProviderInstallStateImpl(int render_process_id, Profile* profile); 28 SearchProviderInstallStateImpl(int render_process_id, Profile* profile);
29 ~SearchProviderInstallStateImpl() override; 29 ~SearchProviderInstallStateImpl() override;
30 30
31 void Bind(chrome::mojom::SearchProviderInstallStateRequest request); 31 static void Create(int render_process_id,
32 Profile* profile,
33 chrome::mojom::SearchProviderInstallStateRequest request);
32 34
33 private: 35 private:
36 void BindOnIOThread(chrome::mojom::SearchProviderInstallStateRequest request);
37
34 // Figures out the install state for the search provider. 38 // Figures out the install state for the search provider.
35 chrome::mojom::InstallState GetSearchProviderInstallState( 39 chrome::mojom::InstallState GetSearchProviderInstallState(
36 const GURL& page_location, 40 const GURL& page_location,
37 const GURL& requested_host); 41 const GURL& requested_host);
38 42
39 // Starts handling the message requesting the search provider install state. 43 // Starts handling the message requesting the search provider install state.
40 // chrome::mojom::SearchProviderInstallState override. 44 // chrome::mojom::SearchProviderInstallState override.
41 void GetInstallState(const GURL& page_location, 45 void GetInstallState(const GURL& page_location,
42 const GURL& requested_host, 46 const GURL& requested_host,
43 const GetInstallStateCallback& callback) override; 47 const GetInstallStateCallback& callback) override;
44 48
45 // Sends the reply message about the search provider install state. 49 // Sends the reply message about the search provider install state.
46 void ReplyWithProviderInstallState(const GURL& page_location, 50 void ReplyWithProviderInstallState(const GURL& page_location,
47 const GURL& requested_host, 51 const GURL& requested_host,
48 const GetInstallStateCallback& callback); 52 const GetInstallStateCallback& callback);
49 53
50 // Used to do a load and get information about install states. 54 // Used to do a load and get information about install states.
51 SearchProviderInstallData provider_data_; 55 SearchProviderInstallData provider_data_;
52 56
53 // Copied from the profile since the profile can't be accessed on the I/O 57 // Copied from the profile since the profile can't be accessed on the I/O
54 // thread. 58 // thread.
55 const bool is_off_the_record_; 59 const bool is_off_the_record_;
56 60
57 mojo::BindingSet<chrome::mojom::SearchProviderInstallState> binding_set_; 61 mojo::StrongBinding<chrome::mojom::SearchProviderInstallState> binding_;
58 62
59 // Used to schedule invocations of ReplyWithProviderInstallState. 63 // Used to schedule invocations of ReplyWithProviderInstallState.
60 base::WeakPtrFactory<SearchProviderInstallStateImpl> weak_factory_; 64 base::WeakPtrFactory<SearchProviderInstallStateImpl> weak_factory_;
61 65
62 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallStateImpl); 66 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallStateImpl);
63 }; 67 };
64 68
65 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_IMPL_H_ 69 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_STATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698