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

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

Issue 1356943004: Add RemoteDeviceLoader to create RemoteDevice from CryptAuth data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webui
Patch Set: move RemoteDevice creation in tests to util function Created 5 years, 2 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"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 namespace cryptauth { 26 namespace cryptauth {
27 class ExternalDeviceInfo; 27 class ExternalDeviceInfo;
28 } 28 }
29 29
30 namespace proximity_auth { 30 namespace proximity_auth {
31 31
32 class ReachablePhoneFlow; 32 class ReachablePhoneFlow;
33 class RemoteDeviceLifeCycle; 33 class RemoteDeviceLifeCycle;
34 class RemoteDeviceLoader;
34 struct RemoteStatusUpdate; 35 struct RemoteStatusUpdate;
35 class SecureContext;
36 36
37 // Handles messages from the chrome://proximity-auth page. 37 // Handles messages from the chrome://proximity-auth page.
38 class ProximityAuthWebUIHandler : public content::WebUIMessageHandler, 38 class ProximityAuthWebUIHandler : public content::WebUIMessageHandler,
39 public LogBuffer::Observer, 39 public LogBuffer::Observer,
40 public CryptAuthEnrollmentManager::Observer, 40 public CryptAuthEnrollmentManager::Observer,
41 public CryptAuthDeviceManager::Observer, 41 public CryptAuthDeviceManager::Observer,
42 public RemoteDeviceLifeCycle::Observer, 42 public RemoteDeviceLifeCycle::Observer,
43 public MessengerObserver { 43 public MessengerObserver {
44 public: 44 public:
45 // |client_| is not owned and must outlive this instance. 45 // |client_| is not owned and must outlive this instance.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void OnEasyUnlockToggled(const cryptauth::ToggleEasyUnlockResponse& response); 89 void OnEasyUnlockToggled(const cryptauth::ToggleEasyUnlockResponse& response);
90 90
91 // Called when the findEligibleUnlockDevices request succeeds. 91 // Called when the findEligibleUnlockDevices request succeeds.
92 void OnFoundEligibleUnlockDevices( 92 void OnFoundEligibleUnlockDevices(
93 const cryptauth::FindEligibleUnlockDevicesResponse& response); 93 const cryptauth::FindEligibleUnlockDevicesResponse& response);
94 94
95 // Callback when |reachable_phone_flow_| completes. 95 // Callback when |reachable_phone_flow_| completes.
96 void OnReachablePhonesFound( 96 void OnReachablePhonesFound(
97 const std::vector<cryptauth::ExternalDeviceInfo>& reachable_phones); 97 const std::vector<cryptauth::ExternalDeviceInfo>& reachable_phones);
98 98
99 // Called when the key agreement of PSK of the remote device completes. 99 // Called when the RemoteDevice is loaded so we can create a connection.
100 void OnPSKDerived(const cryptauth::ExternalDeviceInfo& unlock_key, 100 void OnRemoteDevicesLoaded(const std::vector<RemoteDevice>& remote_devices);
101 const std::string& persistent_symmetric_key);
102 101
103 // Converts an ExternalDeviceInfo proto to a JSON dictionary used in 102 // Converts an ExternalDeviceInfo proto to a JSON dictionary used in
104 // JavaScript. 103 // JavaScript.
105 scoped_ptr<base::DictionaryValue> ExternalDeviceInfoToDictionary( 104 scoped_ptr<base::DictionaryValue> ExternalDeviceInfoToDictionary(
106 const cryptauth::ExternalDeviceInfo& device_info); 105 const cryptauth::ExternalDeviceInfo& device_info);
107 106
108 // Converts an IneligibleDevice proto to a JSON dictionary used in JavaScript. 107 // Converts an IneligibleDevice proto to a JSON dictionary used in JavaScript.
109 scoped_ptr<base::DictionaryValue> IneligibleDeviceToDictionary( 108 scoped_ptr<base::DictionaryValue> IneligibleDeviceToDictionary(
110 const cryptauth::IneligibleDevice& ineligible_device); 109 const cryptauth::IneligibleDevice& ineligible_device);
111 110
(...skipping 27 matching lines...) Expand all
139 138
140 // The flow for getting a list of reachable phones. 139 // The flow for getting a list of reachable phones.
141 scoped_ptr<ReachablePhoneFlow> reachable_phone_flow_; 140 scoped_ptr<ReachablePhoneFlow> reachable_phone_flow_;
142 141
143 // True if we get a message from the loaded WebContents to know that it is 142 // True if we get a message from the loaded WebContents to know that it is
144 // initialized, and we can inject JavaScript. 143 // initialized, and we can inject JavaScript.
145 bool web_contents_initialized_; 144 bool web_contents_initialized_;
146 145
147 // Member variables for connecting to and authenticating the remote device. 146 // Member variables for connecting to and authenticating the remote device.
148 // TODO(tengs): Support multiple simultaenous connections. 147 // TODO(tengs): Support multiple simultaenous connections.
149 scoped_ptr<SecureMessageDelegate> secure_message_delegate_; 148 scoped_ptr<RemoteDeviceLoader> remote_device_loader_;
150 RemoteDevice selected_remote_device_; 149 RemoteDevice selected_remote_device_;
151 scoped_ptr<RemoteDeviceLifeCycle> life_cycle_; 150 scoped_ptr<RemoteDeviceLifeCycle> life_cycle_;
152 scoped_ptr<RemoteStatusUpdate> last_remote_status_update_; 151 scoped_ptr<RemoteStatusUpdate> last_remote_status_update_;
153 152
154 base::WeakPtrFactory<ProximityAuthWebUIHandler> weak_ptr_factory_; 153 base::WeakPtrFactory<ProximityAuthWebUIHandler> weak_ptr_factory_;
155 154
156 DISALLOW_COPY_AND_ASSIGN(ProximityAuthWebUIHandler); 155 DISALLOW_COPY_AND_ASSIGN(ProximityAuthWebUIHandler);
157 }; 156 };
158 157
159 } // namespace proximity_auth 158 } // namespace proximity_auth
160 159
161 #endif // COMPONENTS_PROXIMITY_AUTH_WEBUI_PROXIMITY_AUTH_WEBUI_HANDLER_H_ 160 #endif // COMPONENTS_PROXIMITY_AUTH_WEBUI_PROXIMITY_AUTH_WEBUI_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698