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

Side by Side Diff: components/proximity_auth/proximity_monitor_impl.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/proximity_monitor_impl.h" 5 #include "components/proximity_auth/proximity_monitor_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 14 matching lines...) Expand all
25 // The time to wait, in milliseconds, between proximity polling iterations. 25 // The time to wait, in milliseconds, between proximity polling iterations.
26 const int kPollingTimeoutMs = 250; 26 const int kPollingTimeoutMs = 250;
27 27
28 // The RSSI threshold below which we consider the remote device to not be in 28 // The RSSI threshold below which we consider the remote device to not be in
29 // proximity. 29 // proximity.
30 const int kRssiThreshold = -5; 30 const int kRssiThreshold = -5;
31 31
32 // The weight of the most recent RSSI sample. 32 // The weight of the most recent RSSI sample.
33 const double kRssiSampleWeight = 0.3; 33 const double kRssiSampleWeight = 0.3;
34 34
35 ProximityMonitorImpl::ProximityMonitorImpl(const RemoteDevice& remote_device, 35 ProximityMonitorImpl::ProximityMonitorImpl(
36 scoped_ptr<base::TickClock> clock) 36 const RemoteDevice& remote_device,
37 std::unique_ptr<base::TickClock> clock)
37 : remote_device_(remote_device), 38 : remote_device_(remote_device),
38 strategy_(Strategy::NONE), 39 strategy_(Strategy::NONE),
39 remote_device_is_in_proximity_(false), 40 remote_device_is_in_proximity_(false),
40 is_active_(false), 41 is_active_(false),
41 clock_(std::move(clock)), 42 clock_(std::move(clock)),
42 polling_weak_ptr_factory_(this), 43 polling_weak_ptr_factory_(this),
43 weak_ptr_factory_(this) { 44 weak_ptr_factory_(this) {
44 if (device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { 45 if (device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) {
45 device::BluetoothAdapterFactory::GetAdapter( 46 device::BluetoothAdapterFactory::GetAdapter(
46 base::Bind(&ProximityMonitorImpl::OnAdapterInitialized, 47 base::Bind(&ProximityMonitorImpl::OnAdapterInitialized,
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 if (remote_device_is_in_proximity_ != is_now_in_proximity) { 272 if (remote_device_is_in_proximity_ != is_now_in_proximity) {
272 PA_LOG(INFO) << "[Proximity] Updated proximity state: " 273 PA_LOG(INFO) << "[Proximity] Updated proximity state: "
273 << (is_now_in_proximity ? "proximate" : "distant"); 274 << (is_now_in_proximity ? "proximate" : "distant");
274 remote_device_is_in_proximity_ = is_now_in_proximity; 275 remote_device_is_in_proximity_ = is_now_in_proximity;
275 FOR_EACH_OBSERVER(ProximityMonitorObserver, observers_, 276 FOR_EACH_OBSERVER(ProximityMonitorObserver, observers_,
276 OnProximityStateChanged()); 277 OnProximityStateChanged());
277 } 278 }
278 } 279 }
279 280
280 } // namespace proximity_auth 281 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/proximity_monitor_impl.h ('k') | components/proximity_auth/proximity_monitor_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698