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

Side by Side Diff: components/proximity_auth/cryptauth/cryptauth_enrollment_manager.cc

Issue 2250023005: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h" 5 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64url.h" 9 #include "base/base64url.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 !success); 153 !success);
154 154
155 sync_request_->OnDidComplete(success); 155 sync_request_->OnDidComplete(success);
156 cryptauth_enroller_.reset(); 156 cryptauth_enroller_.reset();
157 sync_request_.reset(); 157 sync_request_.reset();
158 FOR_EACH_OBSERVER(Observer, observers_, OnEnrollmentFinished(success)); 158 FOR_EACH_OBSERVER(Observer, observers_, OnEnrollmentFinished(success));
159 } 159 }
160 160
161 std::unique_ptr<SyncScheduler> 161 std::unique_ptr<SyncScheduler>
162 CryptAuthEnrollmentManager::CreateSyncScheduler() { 162 CryptAuthEnrollmentManager::CreateSyncScheduler() {
163 return base::WrapUnique(new SyncSchedulerImpl( 163 return base::MakeUnique<SyncSchedulerImpl>(
164 this, base::TimeDelta::FromDays(kEnrollmentRefreshPeriodDays), 164 this, base::TimeDelta::FromDays(kEnrollmentRefreshPeriodDays),
165 base::TimeDelta::FromMinutes(kEnrollmentBaseRecoveryPeriodMinutes), 165 base::TimeDelta::FromMinutes(kEnrollmentBaseRecoveryPeriodMinutes),
166 kEnrollmentMaxJitterRatio, "CryptAuth Enrollment")); 166 kEnrollmentMaxJitterRatio, "CryptAuth Enrollment");
167 } 167 }
168 168
169 std::string CryptAuthEnrollmentManager::GetUserPublicKey() { 169 std::string CryptAuthEnrollmentManager::GetUserPublicKey() {
170 std::string public_key; 170 std::string public_key;
171 if (!base::Base64UrlDecode( 171 if (!base::Base64UrlDecode(
172 pref_service_->GetString(prefs::kCryptAuthEnrollmentUserPublicKey), 172 pref_service_->GetString(prefs::kCryptAuthEnrollmentUserPublicKey),
173 base::Base64UrlDecodePolicy::REQUIRE_PADDING, &public_key)) { 173 base::Base64UrlDecodePolicy::REQUIRE_PADDING, &public_key)) {
174 PA_LOG(ERROR) << "Invalid public key stored in user prefs."; 174 PA_LOG(ERROR) << "Invalid public key stored in user prefs.";
175 return std::string(); 175 return std::string();
176 } 176 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 << device_info.gcm_registration_id(); 293 << device_info.gcm_registration_id();
294 294
295 cryptauth_enroller_ = enroller_factory_->CreateInstance(); 295 cryptauth_enroller_ = enroller_factory_->CreateInstance();
296 cryptauth_enroller_->Enroll( 296 cryptauth_enroller_->Enroll(
297 GetUserPublicKey(), GetUserPrivateKey(), device_info, invocation_reason, 297 GetUserPublicKey(), GetUserPrivateKey(), device_info, invocation_reason,
298 base::Bind(&CryptAuthEnrollmentManager::OnEnrollmentFinished, 298 base::Bind(&CryptAuthEnrollmentManager::OnEnrollmentFinished,
299 weak_ptr_factory_.GetWeakPtr())); 299 weak_ptr_factory_.GetWeakPtr()));
300 } 300 }
301 301
302 } // namespace proximity_auth 302 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698