OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/wifi_sync/wifi_credential_syncable_service.h" | 5 #include "components/wifi_sync/wifi_credential_syncable_service.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "components/wifi_sync/wifi_credential.h" | 12 #include "components/wifi_sync/wifi_credential.h" |
12 #include "components/wifi_sync/wifi_security_class.h" | 13 #include "components/wifi_sync/wifi_security_class.h" |
13 #include "sync/api/sync_change.h" | 14 #include "sync/api/sync_change.h" |
14 #include "sync/api/sync_data.h" | 15 #include "sync/api/sync_data.h" |
15 #include "sync/api/sync_error.h" | 16 #include "sync/api/sync_error.h" |
16 #include "sync/api/sync_error_factory.h" | 17 #include "sync/api/sync_error_factory.h" |
17 #include "sync/api/sync_merge_result.h" | 18 #include "sync/api/sync_merge_result.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return ParseSpecifics(sync_data.GetSpecifics(), raw_credential); | 101 return ParseSpecifics(sync_data.GetSpecifics(), raw_credential); |
101 } | 102 } |
102 | 103 |
103 } // namespace | 104 } // namespace |
104 | 105 |
105 const syncer::ModelType WifiCredentialSyncableService::kModelType = | 106 const syncer::ModelType WifiCredentialSyncableService::kModelType = |
106 syncer::WIFI_CREDENTIALS; | 107 syncer::WIFI_CREDENTIALS; |
107 | 108 |
108 WifiCredentialSyncableService::WifiCredentialSyncableService( | 109 WifiCredentialSyncableService::WifiCredentialSyncableService( |
109 scoped_ptr<WifiConfigDelegate> network_config_delegate) | 110 scoped_ptr<WifiConfigDelegate> network_config_delegate) |
110 : network_config_delegate_(network_config_delegate.Pass()) { | 111 : network_config_delegate_(std::move(network_config_delegate)) { |
111 DCHECK(network_config_delegate_); | 112 DCHECK(network_config_delegate_); |
112 } | 113 } |
113 | 114 |
114 WifiCredentialSyncableService::~WifiCredentialSyncableService() { | 115 WifiCredentialSyncableService::~WifiCredentialSyncableService() { |
115 } | 116 } |
116 | 117 |
117 syncer::SyncMergeResult WifiCredentialSyncableService::MergeDataAndStartSyncing( | 118 syncer::SyncMergeResult WifiCredentialSyncableService::MergeDataAndStartSyncing( |
118 syncer::ModelType type, | 119 syncer::ModelType type, |
119 const syncer::SyncDataList& initial_sync_data, | 120 const syncer::SyncDataList& initial_sync_data, |
120 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 121 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
121 scoped_ptr<syncer::SyncErrorFactory> /* error_handler */) { | 122 scoped_ptr<syncer::SyncErrorFactory> /* error_handler */) { |
122 DCHECK(!sync_processor_.get()); | 123 DCHECK(!sync_processor_.get()); |
123 DCHECK(sync_processor.get()); | 124 DCHECK(sync_processor.get()); |
124 DCHECK_EQ(kModelType, type); | 125 DCHECK_EQ(kModelType, type); |
125 | 126 |
126 sync_processor_ = sync_processor.Pass(); | 127 sync_processor_ = std::move(sync_processor); |
127 | 128 |
128 // TODO(quiche): Update local WiFi configuration from |initial_sync_data|. | 129 // TODO(quiche): Update local WiFi configuration from |initial_sync_data|. |
129 // TODO(quiche): Notify upper layers that sync is ready. | 130 // TODO(quiche): Notify upper layers that sync is ready. |
130 NOTIMPLEMENTED(); | 131 NOTIMPLEMENTED(); |
131 | 132 |
132 return syncer::SyncMergeResult(type); | 133 return syncer::SyncMergeResult(type); |
133 } | 134 } |
134 | 135 |
135 void WifiCredentialSyncableService::StopSyncing(syncer::ModelType type) { | 136 void WifiCredentialSyncableService::StopSyncing(syncer::ModelType type) { |
136 DCHECK_EQ(kModelType, type); | 137 DCHECK_EQ(kModelType, type); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 if (sync_error.IsSet()) { | 225 if (sync_error.IsSet()) { |
225 LOG(ERROR) << sync_error.ToString(); | 226 LOG(ERROR) << sync_error.ToString(); |
226 return false; | 227 return false; |
227 } | 228 } |
228 | 229 |
229 synced_networks_and_passphrases_[network_id] = credential.passphrase(); | 230 synced_networks_and_passphrases_[network_id] = credential.passphrase(); |
230 return true; | 231 return true; |
231 } | 232 } |
232 | 233 |
233 } // namespace wifi_sync | 234 } // namespace wifi_sync |
OLD | NEW |