| OLD | NEW |
| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 // Callback when |reachable_phone_flow_| completes. | 96 // Callback when |reachable_phone_flow_| completes. |
| 97 void OnReachablePhonesFound( | 97 void OnReachablePhonesFound( |
| 98 const std::vector<cryptauth::ExternalDeviceInfo>& reachable_phones); | 98 const std::vector<cryptauth::ExternalDeviceInfo>& reachable_phones); |
| 99 | 99 |
| 100 // Called when the RemoteDevice is loaded so we can create a connection. | 100 // Called when the RemoteDevice is loaded so we can create a connection. |
| 101 void OnRemoteDevicesLoaded(const std::vector<RemoteDevice>& remote_devices); | 101 void OnRemoteDevicesLoaded(const std::vector<RemoteDevice>& remote_devices); |
| 102 | 102 |
| 103 // Converts an ExternalDeviceInfo proto to a JSON dictionary used in | 103 // Converts an ExternalDeviceInfo proto to a JSON dictionary used in |
| 104 // JavaScript. | 104 // JavaScript. |
| 105 scoped_ptr<base::DictionaryValue> ExternalDeviceInfoToDictionary( | 105 std::unique_ptr<base::DictionaryValue> ExternalDeviceInfoToDictionary( |
| 106 const cryptauth::ExternalDeviceInfo& device_info); | 106 const cryptauth::ExternalDeviceInfo& device_info); |
| 107 | 107 |
| 108 // Converts an IneligibleDevice proto to a JSON dictionary used in JavaScript. | 108 // Converts an IneligibleDevice proto to a JSON dictionary used in JavaScript. |
| 109 scoped_ptr<base::DictionaryValue> IneligibleDeviceToDictionary( | 109 std::unique_ptr<base::DictionaryValue> IneligibleDeviceToDictionary( |
| 110 const cryptauth::IneligibleDevice& ineligible_device); | 110 const cryptauth::IneligibleDevice& ineligible_device); |
| 111 | 111 |
| 112 // Cleans up the connection to the selected remote device. | 112 // Cleans up the connection to the selected remote device. |
| 113 void CleanUpRemoteDeviceLifeCycle(); | 113 void CleanUpRemoteDeviceLifeCycle(); |
| 114 | 114 |
| 115 // RemoteDeviceLifeCycle::Observer: | 115 // RemoteDeviceLifeCycle::Observer: |
| 116 void OnLifeCycleStateChanged(RemoteDeviceLifeCycle::State old_state, | 116 void OnLifeCycleStateChanged(RemoteDeviceLifeCycle::State old_state, |
| 117 RemoteDeviceLifeCycle::State new_state) override; | 117 RemoteDeviceLifeCycle::State new_state) override; |
| 118 | 118 |
| 119 // MessengerObserver: | 119 // MessengerObserver: |
| 120 void OnRemoteStatusUpdate(const RemoteStatusUpdate& status_update) override; | 120 void OnRemoteStatusUpdate(const RemoteStatusUpdate& status_update) override; |
| 121 | 121 |
| 122 // Returns the current enrollment state that can be used as a JSON object. | 122 // Returns the current enrollment state that can be used as a JSON object. |
| 123 scoped_ptr<base::DictionaryValue> GetEnrollmentStateDictionary(); | 123 std::unique_ptr<base::DictionaryValue> GetEnrollmentStateDictionary(); |
| 124 | 124 |
| 125 // Returns the current device sync state that can be used as a JSON object. | 125 // Returns the current device sync state that can be used as a JSON object. |
| 126 scoped_ptr<base::DictionaryValue> GetDeviceSyncStateDictionary(); | 126 std::unique_ptr<base::DictionaryValue> GetDeviceSyncStateDictionary(); |
| 127 | 127 |
| 128 // Returns the current unlock keys that can be used as a JSON object. | 128 // Returns the current unlock keys that can be used as a JSON object. |
| 129 scoped_ptr<base::ListValue> GetUnlockKeysList(); | 129 std::unique_ptr<base::ListValue> GetUnlockKeysList(); |
| 130 | 130 |
| 131 // The delegate used to fetch dependencies. Must outlive this instance. | 131 // The delegate used to fetch dependencies. Must outlive this instance. |
| 132 ProximityAuthClient* proximity_auth_client_; | 132 ProximityAuthClient* proximity_auth_client_; |
| 133 | 133 |
| 134 // Creates CryptAuth client instances to make API calls. | 134 // Creates CryptAuth client instances to make API calls. |
| 135 scoped_ptr<CryptAuthClientFactory> cryptauth_client_factory_; | 135 std::unique_ptr<CryptAuthClientFactory> cryptauth_client_factory_; |
| 136 | 136 |
| 137 // We only support one concurrent API call. | 137 // We only support one concurrent API call. |
| 138 scoped_ptr<CryptAuthClient> cryptauth_client_; | 138 std::unique_ptr<CryptAuthClient> cryptauth_client_; |
| 139 | 139 |
| 140 // The flow for getting a list of reachable phones. | 140 // The flow for getting a list of reachable phones. |
| 141 scoped_ptr<ReachablePhoneFlow> reachable_phone_flow_; | 141 std::unique_ptr<ReachablePhoneFlow> reachable_phone_flow_; |
| 142 | 142 |
| 143 // True if we get a message from the loaded WebContents to know that it is | 143 // True if we get a message from the loaded WebContents to know that it is |
| 144 // initialized, and we can inject JavaScript. | 144 // initialized, and we can inject JavaScript. |
| 145 bool web_contents_initialized_; | 145 bool web_contents_initialized_; |
| 146 | 146 |
| 147 // Member variables for connecting to and authenticating the remote device. | 147 // Member variables for connecting to and authenticating the remote device. |
| 148 // TODO(tengs): Support multiple simultaenous connections. | 148 // TODO(tengs): Support multiple simultaenous connections. |
| 149 scoped_ptr<RemoteDeviceLoader> remote_device_loader_; | 149 std::unique_ptr<RemoteDeviceLoader> remote_device_loader_; |
| 150 RemoteDevice selected_remote_device_; | 150 RemoteDevice selected_remote_device_; |
| 151 scoped_ptr<RemoteDeviceLifeCycle> life_cycle_; | 151 std::unique_ptr<RemoteDeviceLifeCycle> life_cycle_; |
| 152 scoped_ptr<RemoteStatusUpdate> last_remote_status_update_; | 152 std::unique_ptr<RemoteStatusUpdate> last_remote_status_update_; |
| 153 | 153 |
| 154 base::WeakPtrFactory<ProximityAuthWebUIHandler> weak_ptr_factory_; | 154 base::WeakPtrFactory<ProximityAuthWebUIHandler> weak_ptr_factory_; |
| 155 | 155 |
| 156 DISALLOW_COPY_AND_ASSIGN(ProximityAuthWebUIHandler); | 156 DISALLOW_COPY_AND_ASSIGN(ProximityAuthWebUIHandler); |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 } // namespace proximity_auth | 159 } // namespace proximity_auth |
| 160 | 160 |
| 161 #endif // COMPONENTS_PROXIMITY_AUTH_WEBUI_PROXIMITY_AUTH_WEBUI_HANDLER_H_ | 161 #endif // COMPONENTS_PROXIMITY_AUTH_WEBUI_PROXIMITY_AUTH_WEBUI_HANDLER_H_ |
| OLD | NEW |