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

Side by Side Diff: components/proximity_auth/webui/proximity_auth_webui_handler.h

Issue 1302313004: Replace ProximityAuthUIDelegate with ProximityAuthClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@proximity_auth_client
Patch Set: fixes Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_PROXIMITY_AUTH_WEBUI_PROXIMITY_AUTH_WEBUI_HANDLER_H_ 5 #ifndef COMPONENTS_PROXIMITY_AUTH_WEBUI_PROXIMITY_AUTH_WEBUI_HANDLER_H_
6 #define COMPONENTS_PROXIMITY_AUTH_WEBUI_PROXIMITY_AUTH_WEBUI_HANDLER_H_ 6 #define COMPONENTS_PROXIMITY_AUTH_WEBUI_PROXIMITY_AUTH_WEBUI_HANDLER_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "components/proximity_auth/authenticator.h" 10 #include "components/proximity_auth/authenticator.h"
11 #include "components/proximity_auth/client_observer.h" 11 #include "components/proximity_auth/client_observer.h"
12 #include "components/proximity_auth/connection_observer.h" 12 #include "components/proximity_auth/connection_observer.h"
13 #include "components/proximity_auth/cryptauth/cryptauth_client.h" 13 #include "components/proximity_auth/cryptauth/cryptauth_client.h"
14 #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h" 14 #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h"
15 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h" 15 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h"
16 #include "components/proximity_auth/cryptauth/cryptauth_gcm_manager.h" 16 #include "components/proximity_auth/cryptauth/cryptauth_gcm_manager.h"
17 #include "components/proximity_auth/logging/log_buffer.h" 17 #include "components/proximity_auth/logging/log_buffer.h"
18 #include "components/proximity_auth/webui/proximity_auth_ui_delegate.h" 18 #include "components/proximity_auth/proximity_auth_client.h"
19 #include "content/public/browser/web_ui_message_handler.h" 19 #include "content/public/browser/web_ui_message_handler.h"
20 20
21 namespace base { 21 namespace base {
22 class ListValue; 22 class ListValue;
23 } 23 }
24 24
25 namespace cryptauth { 25 namespace cryptauth {
26 class ExternalDeviceInfo; 26 class ExternalDeviceInfo;
27 } 27 }
28 28
(...skipping 11 matching lines...) Expand all
40 class SecureContext; 40 class SecureContext;
41 41
42 // Handles messages from the chrome://proximity-auth page. 42 // Handles messages from the chrome://proximity-auth page.
43 class ProximityAuthWebUIHandler : public content::WebUIMessageHandler, 43 class ProximityAuthWebUIHandler : public content::WebUIMessageHandler,
44 public LogBuffer::Observer, 44 public LogBuffer::Observer,
45 public CryptAuthEnrollmentManager::Observer, 45 public CryptAuthEnrollmentManager::Observer,
46 public CryptAuthDeviceManager::Observer, 46 public CryptAuthDeviceManager::Observer,
47 public ConnectionObserver, 47 public ConnectionObserver,
48 public ClientObserver { 48 public ClientObserver {
49 public: 49 public:
50 // |delegate| is not owned and must outlive this instance. 50 // |client_| is not owned and must outlive this instance.
51 explicit ProximityAuthWebUIHandler(ProximityAuthUIDelegate* delegate); 51 explicit ProximityAuthWebUIHandler(
52 ProximityAuthClient* proximity_auth_client);
52 ~ProximityAuthWebUIHandler() override; 53 ~ProximityAuthWebUIHandler() override;
53 54
54 // content::WebUIMessageHandler: 55 // content::WebUIMessageHandler:
55 void RegisterMessages() override; 56 void RegisterMessages() override;
56 57
57 private: 58 private:
58 // LogBuffer::Observer: 59 // LogBuffer::Observer:
59 void OnLogMessageAdded(const LogBuffer::LogMessage& log_message) override; 60 void OnLogMessageAdded(const LogBuffer::LogMessage& log_message) override;
60 void OnLogBufferCleared() override; 61 void OnLogBufferCleared() override;
61 62
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // Returns the current enrollment state that can be used as a JSON object. 147 // Returns the current enrollment state that can be used as a JSON object.
147 scoped_ptr<base::DictionaryValue> GetEnrollmentStateDictionary(); 148 scoped_ptr<base::DictionaryValue> GetEnrollmentStateDictionary();
148 149
149 // Returns the current device sync state that can be used as a JSON object. 150 // Returns the current device sync state that can be used as a JSON object.
150 scoped_ptr<base::DictionaryValue> GetDeviceSyncStateDictionary(); 151 scoped_ptr<base::DictionaryValue> GetDeviceSyncStateDictionary();
151 152
152 // Returns the current unlock keys that can be used as a JSON object. 153 // Returns the current unlock keys that can be used as a JSON object.
153 scoped_ptr<base::ListValue> GetUnlockKeysList(); 154 scoped_ptr<base::ListValue> GetUnlockKeysList();
154 155
155 // The delegate used to fetch dependencies. Must outlive this instance. 156 // The delegate used to fetch dependencies. Must outlive this instance.
156 ProximityAuthUIDelegate* delegate_; 157 ProximityAuthClient* proximity_auth_client_;
157 158
158 // Creates CryptAuth client instances to make API calls. 159 // Creates CryptAuth client instances to make API calls.
159 scoped_ptr<CryptAuthClientFactory> cryptauth_client_factory_; 160 scoped_ptr<CryptAuthClientFactory> cryptauth_client_factory_;
160 161
161 // We only support one concurrent API call. 162 // We only support one concurrent API call.
162 scoped_ptr<CryptAuthClient> cryptauth_client_; 163 scoped_ptr<CryptAuthClient> cryptauth_client_;
163 164
164 // The flow for getting a list of reachable phones. 165 // The flow for getting a list of reachable phones.
165 scoped_ptr<ReachablePhoneFlow> reachable_phone_flow_; 166 scoped_ptr<ReachablePhoneFlow> reachable_phone_flow_;
166 167
167 // Member variables related to CryptAuth debugging. 168 // True if we get a message from the loaded WebContents to know that it is
168 // TODO(tengs): These members are temporarily used for development. 169 // initialized, and we can inject JavaScript.
169 scoped_ptr<PrefService> pref_service; 170 bool web_contents_initialized_;
170 scoped_ptr<CryptAuthGCMManager> gcm_manager_;
171 scoped_ptr<CryptAuthEnrollmentManager> enrollment_manager_;
172 scoped_ptr<CryptAuthDeviceManager> device_manager_;
173 171
174 // Member variables for connecting to and authenticating the remote device. 172 // Member variables for connecting to and authenticating the remote device.
175 // TODO(tengs): Support multiple simultaenous connections. 173 // TODO(tengs): Support multiple simultaenous connections.
176 scoped_ptr<SecureMessageDelegate> secure_message_delegate_; 174 scoped_ptr<SecureMessageDelegate> secure_message_delegate_;
177 scoped_ptr<BluetoothLowEnergyDeviceWhitelist> ble_device_whitelist_; 175 scoped_ptr<BluetoothLowEnergyDeviceWhitelist> ble_device_whitelist_;
178 RemoteDevice selected_remote_device_; 176 RemoteDevice selected_remote_device_;
179 scoped_ptr<BluetoothThrottler> bluetooth_throttler_; 177 scoped_ptr<BluetoothThrottler> bluetooth_throttler_;
180 scoped_ptr<ConnectionFinder> connection_finder_; 178 scoped_ptr<ConnectionFinder> connection_finder_;
181 scoped_ptr<Connection> connection_; 179 scoped_ptr<Connection> connection_;
182 scoped_ptr<Authenticator> authenticator_; 180 scoped_ptr<Authenticator> authenticator_;
183 scoped_ptr<SecureContext> secure_context_; 181 scoped_ptr<SecureContext> secure_context_;
184 scoped_ptr<ClientImpl> client_; 182 scoped_ptr<ClientImpl> client_;
185 scoped_ptr<RemoteStatusUpdate> last_remote_status_update_; 183 scoped_ptr<RemoteStatusUpdate> last_remote_status_update_;
186 184
187 base::WeakPtrFactory<ProximityAuthWebUIHandler> weak_ptr_factory_; 185 base::WeakPtrFactory<ProximityAuthWebUIHandler> weak_ptr_factory_;
188 186
189 DISALLOW_COPY_AND_ASSIGN(ProximityAuthWebUIHandler); 187 DISALLOW_COPY_AND_ASSIGN(ProximityAuthWebUIHandler);
190 }; 188 };
191 189
192 } // namespace proximity_auth 190 } // namespace proximity_auth
193 191
194 #endif // COMPONENTS_PROXIMITY_AUTH_WEBUI_PROXIMITY_AUTH_WEBUI_HANDLER_H_ 192 #endif // COMPONENTS_PROXIMITY_AUTH_WEBUI_PROXIMITY_AUTH_WEBUI_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698