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

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

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 12 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>
8
7 #include "base/base64url.h" 9 #include "base/base64url.h"
8 #include "base/prefs/pref_registry_simple.h" 10 #include "base/prefs/pref_registry_simple.h"
9 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
10 #include "base/time/clock.h" 12 #include "base/time/clock.h"
11 #include "base/time/time.h" 13 #include "base/time/time.h"
12 #include "components/proximity_auth/cryptauth/cryptauth_enroller.h" 14 #include "components/proximity_auth/cryptauth/cryptauth_enroller.h"
13 #include "components/proximity_auth/cryptauth/pref_names.h" 15 #include "components/proximity_auth/cryptauth/pref_names.h"
14 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" 16 #include "components/proximity_auth/cryptauth/secure_message_delegate.h"
15 #include "components/proximity_auth/cryptauth/sync_scheduler_impl.h" 17 #include "components/proximity_auth/cryptauth/sync_scheduler_impl.h"
16 #include "components/proximity_auth/logging/logging.h" 18 #include "components/proximity_auth/logging/logging.h"
(...skipping 24 matching lines...) Expand all
41 43
42 } // namespace 44 } // namespace
43 45
44 CryptAuthEnrollmentManager::CryptAuthEnrollmentManager( 46 CryptAuthEnrollmentManager::CryptAuthEnrollmentManager(
45 scoped_ptr<base::Clock> clock, 47 scoped_ptr<base::Clock> clock,
46 scoped_ptr<CryptAuthEnrollerFactory> enroller_factory, 48 scoped_ptr<CryptAuthEnrollerFactory> enroller_factory,
47 scoped_ptr<SecureMessageDelegate> secure_message_delegate, 49 scoped_ptr<SecureMessageDelegate> secure_message_delegate,
48 const cryptauth::GcmDeviceInfo& device_info, 50 const cryptauth::GcmDeviceInfo& device_info,
49 CryptAuthGCMManager* gcm_manager, 51 CryptAuthGCMManager* gcm_manager,
50 PrefService* pref_service) 52 PrefService* pref_service)
51 : clock_(clock.Pass()), 53 : clock_(std::move(clock)),
52 enroller_factory_(enroller_factory.Pass()), 54 enroller_factory_(std::move(enroller_factory)),
53 secure_message_delegate_(secure_message_delegate.Pass()), 55 secure_message_delegate_(std::move(secure_message_delegate)),
54 device_info_(device_info), 56 device_info_(device_info),
55 gcm_manager_(gcm_manager), 57 gcm_manager_(gcm_manager),
56 pref_service_(pref_service), 58 pref_service_(pref_service),
57 weak_ptr_factory_(this) {} 59 weak_ptr_factory_(this) {}
58 60
59 CryptAuthEnrollmentManager::~CryptAuthEnrollmentManager() { 61 CryptAuthEnrollmentManager::~CryptAuthEnrollmentManager() {
60 gcm_manager_->RemoveObserver(this); 62 gcm_manager_->RemoveObserver(this);
61 } 63 }
62 64
63 // static 65 // static
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 223 }
222 224
223 void CryptAuthEnrollmentManager::OnReenrollMessage() { 225 void CryptAuthEnrollmentManager::OnReenrollMessage() {
224 ForceEnrollmentNow(cryptauth::INVOCATION_REASON_SERVER_INITIATED); 226 ForceEnrollmentNow(cryptauth::INVOCATION_REASON_SERVER_INITIATED);
225 } 227 }
226 228
227 void CryptAuthEnrollmentManager::OnSyncRequested( 229 void CryptAuthEnrollmentManager::OnSyncRequested(
228 scoped_ptr<SyncScheduler::SyncRequest> sync_request) { 230 scoped_ptr<SyncScheduler::SyncRequest> sync_request) {
229 FOR_EACH_OBSERVER(Observer, observers_, OnEnrollmentStarted()); 231 FOR_EACH_OBSERVER(Observer, observers_, OnEnrollmentStarted());
230 232
231 sync_request_ = sync_request.Pass(); 233 sync_request_ = std::move(sync_request);
232 if (gcm_manager_->GetRegistrationId().empty() || 234 if (gcm_manager_->GetRegistrationId().empty() ||
233 pref_service_->GetInteger(prefs::kCryptAuthEnrollmentReason) == 235 pref_service_->GetInteger(prefs::kCryptAuthEnrollmentReason) ==
234 cryptauth::INVOCATION_REASON_MANUAL) { 236 cryptauth::INVOCATION_REASON_MANUAL) {
235 gcm_manager_->RegisterWithGCM(); 237 gcm_manager_->RegisterWithGCM();
236 } else { 238 } else {
237 DoCryptAuthEnrollment(); 239 DoCryptAuthEnrollment();
238 } 240 }
239 } 241 }
240 242
241 void CryptAuthEnrollmentManager::DoCryptAuthEnrollment() { 243 void CryptAuthEnrollmentManager::DoCryptAuthEnrollment() {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 << device_info.gcm_registration_id(); 291 << device_info.gcm_registration_id();
290 292
291 cryptauth_enroller_ = enroller_factory_->CreateInstance(); 293 cryptauth_enroller_ = enroller_factory_->CreateInstance();
292 cryptauth_enroller_->Enroll( 294 cryptauth_enroller_->Enroll(
293 GetUserPublicKey(), GetUserPrivateKey(), device_info, invocation_reason, 295 GetUserPublicKey(), GetUserPrivateKey(), device_info, invocation_reason,
294 base::Bind(&CryptAuthEnrollmentManager::OnEnrollmentFinished, 296 base::Bind(&CryptAuthEnrollmentManager::OnEnrollmentFinished,
295 weak_ptr_factory_.GetWeakPtr())); 297 weak_ptr_factory_.GetWeakPtr()));
296 } 298 }
297 299
298 } // namespace proximity_auth 300 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698