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

Side by Side Diff: components/wifi_sync/wifi_credential_syncable_service.cc

Issue 1917673002: Convert //components/[u-z]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 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 <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 return ParseSpecifics(sync_data.GetSpecifics(), raw_credential); 101 return ParseSpecifics(sync_data.GetSpecifics(), raw_credential);
102 } 102 }
103 103
104 } // namespace 104 } // namespace
105 105
106 const syncer::ModelType WifiCredentialSyncableService::kModelType = 106 const syncer::ModelType WifiCredentialSyncableService::kModelType =
107 syncer::WIFI_CREDENTIALS; 107 syncer::WIFI_CREDENTIALS;
108 108
109 WifiCredentialSyncableService::WifiCredentialSyncableService( 109 WifiCredentialSyncableService::WifiCredentialSyncableService(
110 scoped_ptr<WifiConfigDelegate> network_config_delegate) 110 std::unique_ptr<WifiConfigDelegate> network_config_delegate)
111 : network_config_delegate_(std::move(network_config_delegate)) { 111 : network_config_delegate_(std::move(network_config_delegate)) {
112 DCHECK(network_config_delegate_); 112 DCHECK(network_config_delegate_);
113 } 113 }
114 114
115 WifiCredentialSyncableService::~WifiCredentialSyncableService() { 115 WifiCredentialSyncableService::~WifiCredentialSyncableService() {
116 } 116 }
117 117
118 syncer::SyncMergeResult WifiCredentialSyncableService::MergeDataAndStartSyncing( 118 syncer::SyncMergeResult WifiCredentialSyncableService::MergeDataAndStartSyncing(
119 syncer::ModelType type, 119 syncer::ModelType type,
120 const syncer::SyncDataList& initial_sync_data, 120 const syncer::SyncDataList& initial_sync_data,
121 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, 121 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
122 scoped_ptr<syncer::SyncErrorFactory> /* error_handler */) { 122 std::unique_ptr<syncer::SyncErrorFactory> /* error_handler */) {
123 DCHECK(!sync_processor_.get()); 123 DCHECK(!sync_processor_.get());
124 DCHECK(sync_processor.get()); 124 DCHECK(sync_processor.get());
125 DCHECK_EQ(kModelType, type); 125 DCHECK_EQ(kModelType, type);
126 126
127 sync_processor_ = std::move(sync_processor); 127 sync_processor_ = std::move(sync_processor);
128 128
129 // TODO(quiche): Update local WiFi configuration from |initial_sync_data|. 129 // TODO(quiche): Update local WiFi configuration from |initial_sync_data|.
130 // TODO(quiche): Notify upper layers that sync is ready. 130 // TODO(quiche): Notify upper layers that sync is ready.
131 NOTIMPLEMENTED(); 131 NOTIMPLEMENTED();
132 132
(...skipping 25 matching lines...) Expand all
158 for (const syncer::SyncChange& sync_change : change_list) { 158 for (const syncer::SyncChange& sync_change : change_list) {
159 DCHECK(sync_change.IsValid()); 159 DCHECK(sync_change.IsValid());
160 RawCredentialData raw_credential; 160 RawCredentialData raw_credential;
161 if (!ParseSyncData(sync_change.sync_data(), &raw_credential)) { 161 if (!ParseSyncData(sync_change.sync_data(), &raw_credential)) {
162 LOG(WARNING) << "Failed to parse item; skipping " 162 LOG(WARNING) << "Failed to parse item; skipping "
163 << syncer::SyncChange::ChangeTypeToString( 163 << syncer::SyncChange::ChangeTypeToString(
164 sync_change.change_type()); 164 sync_change.change_type());
165 continue; 165 continue;
166 } 166 }
167 167
168 scoped_ptr<WifiCredential> credential; 168 std::unique_ptr<WifiCredential> credential;
169 switch (sync_change.change_type()) { 169 switch (sync_change.change_type()) {
170 case syncer::SyncChange::ACTION_ADD: 170 case syncer::SyncChange::ACTION_ADD:
171 credential = WifiCredential::Create(raw_credential.ssid, 171 credential = WifiCredential::Create(raw_credential.ssid,
172 raw_credential.security_class, 172 raw_credential.security_class,
173 raw_credential.passphrase); 173 raw_credential.passphrase);
174 if (!credential) 174 if (!credential)
175 LOG(WARNING) << "Failed to create credential; skipping"; 175 LOG(WARNING) << "Failed to create credential; skipping";
176 else 176 else
177 network_config_delegate_->AddToLocalNetworks(*credential); 177 network_config_delegate_->AddToLocalNetworks(*credential);
178 break; 178 break;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (sync_error.IsSet()) { 225 if (sync_error.IsSet()) {
226 LOG(ERROR) << sync_error.ToString(); 226 LOG(ERROR) << sync_error.ToString();
227 return false; 227 return false;
228 } 228 }
229 229
230 synced_networks_and_passphrases_[network_id] = credential.passphrase(); 230 synced_networks_and_passphrases_[network_id] = credential.passphrase();
231 return true; 231 return true;
232 } 232 }
233 233
234 } // namespace wifi_sync 234 } // namespace wifi_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698