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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PROXIMITY_AUTH_PROXIMITY_MONITOR_H
6 #define COMPONENTS_PROXIMITY_AUTH_PROXIMITY_MONITOR_H
8 namespace proximity_auth
{
10 // An interface that is responsible for tracking whether the remote device is
11 // sufficiently close to the local device to permit unlocking.
12 class ProximityMonitor
{
14 enum class Strategy
{ NONE
, CHECK_RSSI
, CHECK_TRANSMIT_POWER
};
16 virtual ~ProximityMonitor() {}
18 // Activates the proximity monitor. No-op if the proximity monitor is already
20 virtual void Start() = 0;
22 // Deactivates the proximity monitor. No-op if the proximity monitor is
24 virtual void Stop() = 0;
26 // Returns the strategy used to determine whether the remote device is in
28 virtual Strategy
GetStrategy() const = 0;
30 // Returns |true| iff the remote device is close enough to the local device,
31 // given the user's current settings.
32 virtual bool IsUnlockAllowed() const = 0;
34 // Returns |true| iff the remote device is close enough to the local device,
35 // according to its RSSI measurement.
36 virtual bool IsInRssiRange() const = 0;
38 // Records the current proximity measurements to UMA. This should be called
39 // when the user successfully authenticates using proximity auth.
40 virtual void RecordProximityMetricsOnAuthSuccess() = 0;
43 } // namespace proximity_auth
45 #endif // COMPONENTS_PROXIMITY_AUTH_PROXIMITY_MONITOR_H