OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SCREENLOCK_STATE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SCREENLOCK_STATE_HANDLER_H_ |
6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SCREENLOCK_STATE_HANDLER_H_ | 6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SCREENLOCK_STATE_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
12 #include "chrome/browser/signin/screenlock_bridge.h" | 12 #include "chrome/browser/signin/signin_screen_bridge.h" |
13 | 13 |
14 class PrefService; | 14 class PrefService; |
15 | 15 |
16 // Profile specific class responsible for updating screenlock UI for the user | 16 // Profile specific class responsible for updating screenlock UI for the user |
17 // associated with the profile when their Easy Unlock state changes. | 17 // associated with the profile when their Easy Unlock state changes. |
18 class EasyUnlockScreenlockStateHandler : public ScreenlockBridge::Observer { | 18 class EasyUnlockScreenlockStateHandler : public SigninScreenBridge::Observer { |
19 public: | 19 public: |
20 // Available Easy Unlock states. | 20 // Available Easy Unlock states. |
21 enum State { | 21 enum State { |
22 // Easy Unlock is not enabled, or the screen is not locked. | 22 // Easy Unlock is not enabled, or the screen is not locked. |
23 STATE_INACTIVE, | 23 STATE_INACTIVE, |
24 // Bluetooth is not on. | 24 // Bluetooth is not on. |
25 STATE_NO_BLUETOOTH, | 25 STATE_NO_BLUETOOTH, |
26 // Easy Unlock is in process of turning on Bluetooth. | 26 // Easy Unlock is in process of turning on Bluetooth. |
27 STATE_BLUETOOTH_CONNECTING, | 27 STATE_BLUETOOTH_CONNECTING, |
28 // No phones eligible to unlock the device can be found. | 28 // No phones eligible to unlock the device can be found. |
(...skipping 12 matching lines...) Expand all Loading... |
41 // An Easy Unlock enabled phone is found, but it is not allowed to unlock | 41 // An Easy Unlock enabled phone is found, but it is not allowed to unlock |
42 // the device because it does not support reporting it's lock screen state. | 42 // the device because it does not support reporting it's lock screen state. |
43 STATE_PHONE_UNSUPPORTED, | 43 STATE_PHONE_UNSUPPORTED, |
44 // The device can be unlocked using Easy Unlock. | 44 // The device can be unlocked using Easy Unlock. |
45 STATE_AUTHENTICATED | 45 STATE_AUTHENTICATED |
46 }; | 46 }; |
47 | 47 |
48 // |user_email|: The email for the user associated with the profile to which | 48 // |user_email|: The email for the user associated with the profile to which |
49 // this class is attached. | 49 // this class is attached. |
50 // |pref_service|: The profile preferences. | 50 // |pref_service|: The profile preferences. |
51 // |screenlock_bridge|: The screenlock bridge used to update the screen lock | 51 // |signin_screen_bridge|: The screenlock bridge used to update the screen |
52 // state. | 52 // lock state. |
53 EasyUnlockScreenlockStateHandler(const std::string& user_email, | 53 EasyUnlockScreenlockStateHandler(const std::string& user_email, |
54 PrefService* pref_service, | 54 PrefService* pref_service, |
55 ScreenlockBridge* screenlock_bridge); | 55 SigninScreenBridge* signin_screen_bridge); |
56 virtual ~EasyUnlockScreenlockStateHandler(); | 56 virtual ~EasyUnlockScreenlockStateHandler(); |
57 | 57 |
58 // Changes internal state to |new_state| and updates the user's screenlock | 58 // Changes internal state to |new_state| and updates the user's screenlock |
59 // accordingly. | 59 // accordingly. |
60 void ChangeState(State new_state); | 60 void ChangeState(State new_state); |
61 | 61 |
62 private: | 62 private: |
63 // ScreenlockBridge::Observer: | 63 // SigninScreenBridge::Observer: |
64 virtual void OnScreenDidLock() OVERRIDE; | 64 virtual void OnScreenDidLock() OVERRIDE; |
65 virtual void OnScreenDidUnlock() OVERRIDE; | 65 virtual void OnScreenDidUnlock() OVERRIDE; |
66 virtual void OnFocusedUserChanged(const std::string& user_id) OVERRIDE; | 66 virtual void OnFocusedUserChanged(const std::string& user_id) OVERRIDE; |
67 | 67 |
68 // Updates icon's tooltip options. | 68 // Updates icon's tooltip options. |
69 // |trial_run|: Whether the trial Easy Unlock run is in progress. | 69 // |trial_run|: Whether the trial Easy Unlock run is in progress. |
70 void UpdateTooltipOptions( | 70 void UpdateTooltipOptions( |
71 bool trial_run, | 71 bool trial_run, |
72 ScreenlockBridge::UserPodCustomIconOptions* icon_options); | 72 SigninScreenBridge::UserPodCustomIconOptions* icon_options); |
73 | 73 |
74 // Whether this is the first, trial Easy Unlock run. If this is the case, a | 74 // Whether this is the first, trial Easy Unlock run. If this is the case, a |
75 // tutorial message should be shown and hard-locking be disabled in | 75 // tutorial message should be shown and hard-locking be disabled in |
76 // Authenticated state. The trial run will be active if Easy Unlock never | 76 // Authenticated state. The trial run will be active if Easy Unlock never |
77 // entered Authenticated state (across sessions). | 77 // entered Authenticated state (across sessions). |
78 bool IsTrialRun(); | 78 bool IsTrialRun(); |
79 | 79 |
80 // Sets user preference that marks trial run completed. | 80 // Sets user preference that marks trial run completed. |
81 void MarkTrialRunComplete(); | 81 void MarkTrialRunComplete(); |
82 | 82 |
83 // Gets the name to be used for the device. The name depends on the device | 83 // Gets the name to be used for the device. The name depends on the device |
84 // type (example values: Chromebook and Chromebox). | 84 // type (example values: Chromebook and Chromebox). |
85 base::string16 GetDeviceName(); | 85 base::string16 GetDeviceName(); |
86 | 86 |
87 // Updates the screenlock auth type if it has to be changed. | 87 // Updates the screenlock auth type if it has to be changed. |
88 void UpdateScreenlockAuthType(); | 88 void UpdateScreenlockAuthType(); |
89 | 89 |
90 State state_; | 90 State state_; |
91 std::string user_email_; | 91 std::string user_email_; |
92 PrefService* pref_service_; | 92 PrefService* pref_service_; |
93 ScreenlockBridge* screenlock_bridge_; | 93 SigninScreenBridge* signin_screen_bridge_; |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(EasyUnlockScreenlockStateHandler); | 95 DISALLOW_COPY_AND_ASSIGN(EasyUnlockScreenlockStateHandler); |
96 }; | 96 }; |
97 | 97 |
98 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SCREENLOCK_STATE_HANDLER_H_ | 98 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SCREENLOCK_STATE_HANDLER_H_ |
OLD | NEW |