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

Side by Side Diff: chrome/browser/signin/easy_unlock_screenlock_state_handler.h

Issue 446743003: Hook up new API for easy unlock to update lock screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SCREENLOCK_STATE_HANDLER_H_
6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SCREENLOCK_STATE_HANDLER_H_
7
8 #include <string>
9
10 #include "base/strings/string16.h"
11 #include "base/timer/timer.h"
12 #include "chrome/browser/signin/screenlock_bridge.h"
13
14 class PrefService;
15
16 // Profile specific class responsible for updating screenlock UI for the user
17 // associated with the profile when their Easy Unlock state changes.
18 class EasyUnlockScreenlockStateHandler : public ScreenlockBridge::Observer {
19 public:
20 // Available Easy Unlock states.
21 enum State {
22 // Easy Unlock is not enabled, or the screen is not locked.
23 STATE_INACTIVE,
24 // Bluetooth is not on.
25 STATE_NO_BLUETOOTH,
26 // Easy Unlock is in process of turning on Bluetooth.
27 STATE_BLUETOOTH_CONNECTING,
28 // No phones eligible to unlock the device can be found.
29 STATE_NO_PHONE,
30 // A phone eligible to unlock the device is found, but cannot be
31 // authenticated.
32 STATE_PHONE_NOT_AUTHENTICATED,
33 // A phone eligible to unlock the device is found, but it's locked.
34 STATE_PHONE_LOCKED,
35 // A phone eligible to unlock the device is found, but does not have lock
36 // screen enabled.
37 STATE_PHONE_UNLOCKABLE,
38 // A phone eligible to unlock the device is found, but it's not close enough
39 // to be allowed to unlock the device.
40 STATE_PHONE_NOT_NEARBY,
41 // The device can be unlocked using Easy Unlock.
42 STATE_AUTHENTICATED
43 };
44
45 // |user_email|: The email for the user associated with the profile to which
46 // this class is attached.
47 // |pref_service|: The profile preferences.
48 // |screenlock_bridge|: The screenlock bridge used to update the screen lock
49 // state.
50 EasyUnlockScreenlockStateHandler(const std::string& user_email,
51 PrefService* pref_service,
52 ScreenlockBridge* screenlock_bridge);
53 virtual ~EasyUnlockScreenlockStateHandler();
54
55 // Changes internal state to |new_state| and updates the user's screenlock
56 // accordingly.
57 void ChangeState(State new_state);
58
59 private:
60 // ScreenlockBridge::Observer:
61 virtual void OnScreenDidLock() OVERRIDE;
62 virtual void OnScreenDidUnlock() OVERRIDE;
63
64 void UpdateTooltipOptions(
65 ScreenlockBridge::UserPodCustomIconOptions* icon_options);
66
67 // Whether the tutorial message should be shown to the user. The message is
68 // shown only once, when the user encounters STATE_AUTHENTICATED for the first
69 // time (across sessions). After the tutorial message is shown,
70 // |MarkTutorialShown| should be called to prevent further tutorial message.
71 bool ShouldShowTutorial();
72
73 // Sets user preference that prevents showing of tutorial messages.
74 void MarkTutorialShown();
75
76 // Gets the name to be used for the device. The name depends on the device
77 // type (example values: Chromebook and Chromebox).
78 base::string16 GetDeviceName();
79
80 // Updates the screenlock auth type if it has to be changed.
81 void UpdateScreenlockAuthType();
82
83 State state_;
84 std::string user_email_;
85 PrefService* pref_service_;
86 ScreenlockBridge* screenlock_bridge_;
87
88 DISALLOW_COPY_AND_ASSIGN(EasyUnlockScreenlockStateHandler);
89 };
90
91 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SCREENLOCK_STATE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698