| OLD | NEW |
| 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 #ifndef COMPONENTS_PROXIMITY_AUTH_PROXIMITY_MONITOR_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_PROXIMITY_MONITOR_H |
| 6 #define COMPONENTS_PROXIMITY_AUTH_PROXIMITY_MONITOR_H | 6 #define COMPONENTS_PROXIMITY_AUTH_PROXIMITY_MONITOR_H |
| 7 | 7 |
| 8 #include "components/proximity_auth/proximity_monitor_observer.h" | 8 #include "components/proximity_auth/proximity_monitor_observer.h" |
| 9 | 9 |
| 10 namespace proximity_auth { | 10 namespace proximity_auth { |
| 11 | 11 |
| 12 // An interface that is responsible for tracking whether the remote device is | 12 // An interface that is responsible for tracking whether the remote device is |
| 13 // sufficiently close to the local device to permit unlocking. | 13 // sufficiently close to the local device to permit unlocking. |
| 14 class ProximityMonitor { | 14 class ProximityMonitor { |
| 15 public: | 15 public: |
| 16 enum class Strategy { NONE, CHECK_RSSI, CHECK_TRANSMIT_POWER }; | |
| 17 | |
| 18 virtual ~ProximityMonitor() {} | 16 virtual ~ProximityMonitor() {} |
| 19 | 17 |
| 20 // Activates the proximity monitor. No-op if the proximity monitor is already | 18 // Activates the proximity monitor. No-op if the proximity monitor is already |
| 21 // active. | 19 // active. |
| 22 virtual void Start() = 0; | 20 virtual void Start() = 0; |
| 23 | 21 |
| 24 // Deactivates the proximity monitor. No-op if the proximity monitor is | 22 // Deactivates the proximity monitor. No-op if the proximity monitor is |
| 25 // already inactive. | 23 // already inactive. |
| 26 virtual void Stop() = 0; | 24 virtual void Stop() = 0; |
| 27 | 25 |
| 28 // Returns the strategy used to determine whether the remote device is in | |
| 29 // proximity. | |
| 30 virtual Strategy GetStrategy() const = 0; | |
| 31 | |
| 32 // Returns |true| iff the remote device is close enough to the local device, | 26 // Returns |true| iff the remote device is close enough to the local device, |
| 33 // given the user's current settings. | 27 // given the user's current settings. |
| 34 virtual bool IsUnlockAllowed() const = 0; | 28 virtual bool IsUnlockAllowed() const = 0; |
| 35 | 29 |
| 36 // Returns |true| iff the remote device is close enough to the local device, | |
| 37 // according to its RSSI measurement. | |
| 38 virtual bool IsInRssiRange() const = 0; | |
| 39 | |
| 40 // Records the current proximity measurements to UMA. This should be called | 30 // Records the current proximity measurements to UMA. This should be called |
| 41 // when the user successfully authenticates using proximity auth. | 31 // when the user successfully authenticates using proximity auth. |
| 42 virtual void RecordProximityMetricsOnAuthSuccess() = 0; | 32 virtual void RecordProximityMetricsOnAuthSuccess() = 0; |
| 43 | 33 |
| 44 // Adds an observer. | 34 // Adds an observer. |
| 45 virtual void AddObserver(ProximityMonitorObserver* observer) = 0; | 35 virtual void AddObserver(ProximityMonitorObserver* observer) = 0; |
| 46 | 36 |
| 47 // Removes an observer. | 37 // Removes an observer. |
| 48 virtual void RemoveObserver(ProximityMonitorObserver* observer) = 0; | 38 virtual void RemoveObserver(ProximityMonitorObserver* observer) = 0; |
| 49 }; | 39 }; |
| 50 | 40 |
| 51 } // namespace proximity_auth | 41 } // namespace proximity_auth |
| 52 | 42 |
| 53 #endif // COMPONENTS_PROXIMITY_AUTH_PROXIMITY_MONITOR_H | 43 #endif // COMPONENTS_PROXIMITY_AUTH_PROXIMITY_MONITOR_H |
| OLD | NEW |