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

Side by Side Diff: components/proximity_auth/unlock_manager.cc

Issue 1912433002: Convert //components/proximity_auth from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits 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 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/unlock_manager.h" 5 #include "components/proximity_auth/unlock_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h"
10 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
11 #include "base/time/default_tick_clock.h" 12 #include "base/time/default_tick_clock.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
14 #include "components/proximity_auth/logging/logging.h" 15 #include "components/proximity_auth/logging/logging.h"
15 #include "components/proximity_auth/messenger.h" 16 #include "components/proximity_auth/messenger.h"
16 #include "components/proximity_auth/metrics.h" 17 #include "components/proximity_auth/metrics.h"
17 #include "components/proximity_auth/proximity_auth_client.h" 18 #include "components/proximity_auth/proximity_auth_client.h"
18 #include "components/proximity_auth/proximity_monitor_impl.h" 19 #include "components/proximity_auth/proximity_monitor_impl.h"
19 #include "components/proximity_auth/remote_device.h" 20 #include "components/proximity_auth/remote_device.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 if (GetMessenger()->SupportsSignIn()) { 312 if (GetMessenger()->SupportsSignIn()) {
312 GetMessenger()->RequestUnlock(); 313 GetMessenger()->RequestUnlock();
313 } else { 314 } else {
314 PA_LOG(INFO) << "[Unlock] Protocol v3.1 not supported, skipping " 315 PA_LOG(INFO) << "[Unlock] Protocol v3.1 not supported, skipping "
315 << "request_unlock."; 316 << "request_unlock.";
316 GetMessenger()->DispatchUnlockEvent(); 317 GetMessenger()->DispatchUnlockEvent();
317 } 318 }
318 } 319 }
319 } 320 }
320 321
321 scoped_ptr<ProximityMonitor> UnlockManager::CreateProximityMonitor( 322 std::unique_ptr<ProximityMonitor> UnlockManager::CreateProximityMonitor(
322 const RemoteDevice& remote_device) { 323 const RemoteDevice& remote_device) {
323 return make_scoped_ptr(new ProximityMonitorImpl( 324 return base::WrapUnique(new ProximityMonitorImpl(
324 remote_device, make_scoped_ptr(new base::DefaultTickClock()))); 325 remote_device, base::WrapUnique(new base::DefaultTickClock())));
325 } 326 }
326 327
327 void UnlockManager::SendSignInChallenge() { 328 void UnlockManager::SendSignInChallenge() {
328 if (!life_cycle_ || !GetMessenger() || !GetMessenger()->GetSecureContext()) { 329 if (!life_cycle_ || !GetMessenger() || !GetMessenger()->GetSecureContext()) {
329 PA_LOG(ERROR) << "Not ready to send sign-in challenge"; 330 PA_LOG(ERROR) << "Not ready to send sign-in challenge";
330 return; 331 return;
331 } 332 }
332 333
333 RemoteDevice remote_device = life_cycle_->GetRemoteDevice(); 334 RemoteDevice remote_device = life_cycle_->GetRemoteDevice();
334 proximity_auth_client_->GetChallengeForUserAndDevice( 335 proximity_auth_client_->GetChallengeForUserAndDevice(
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 494
494 Messenger* UnlockManager::GetMessenger() { 495 Messenger* UnlockManager::GetMessenger() {
495 // TODO(tengs): We should use a weak pointer to hold the Messenger instance 496 // TODO(tengs): We should use a weak pointer to hold the Messenger instance
496 // instead. 497 // instead.
497 if (!life_cycle_) 498 if (!life_cycle_)
498 return nullptr; 499 return nullptr;
499 return life_cycle_->GetMessenger(); 500 return life_cycle_->GetMessenger();
500 } 501 }
501 502
502 } // namespace proximity_auth 503 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/unlock_manager.h ('k') | components/proximity_auth/unlock_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698