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

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

Issue 628193003: [Easy Unlock] Update handling of the trial easy unlock/signin run (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: autoshow tooltip for hardlock Created 6 years, 2 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 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"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // Hard lock states. 48 // Hard lock states.
49 enum HardlockState { 49 enum HardlockState {
50 NO_HARDLOCK = 0, // Hard lock is not enforced. This is default. 50 NO_HARDLOCK = 0, // Hard lock is not enforced. This is default.
51 USER_HARDLOCK = 1 << 0, // Hard lock is requested by user. 51 USER_HARDLOCK = 1 << 0, // Hard lock is requested by user.
52 PAIRING_CHANGED = 1 << 1, // Hard lock because pairing data is changed. 52 PAIRING_CHANGED = 1 << 1, // Hard lock because pairing data is changed.
53 NO_PAIRING = 1 << 2 // Hard lock because there is no pairing data. 53 NO_PAIRING = 1 << 2 // Hard lock because there is no pairing data.
54 }; 54 };
55 55
56 // |user_email|: The email for the user associated with the profile to which 56 // |user_email|: The email for the user associated with the profile to which
57 // this class is attached. 57 // this class is attached.
58 // |pref_service|: The profile preferences. 58 // |initial_hardlock_state|: The initial hardlock state.
59 // |screenlock_bridge|: The screenlock bridge used to update the screen lock 59 // |screenlock_bridge|: The screenlock bridge used to update the screen lock
60 // state. 60 // state.
61 EasyUnlockScreenlockStateHandler(const std::string& user_email, 61 EasyUnlockScreenlockStateHandler(const std::string& user_email,
62 HardlockState initial_hardlock_state, 62 HardlockState initial_hardlock_state,
63 PrefService* pref_service,
64 ScreenlockBridge* screenlock_bridge); 63 ScreenlockBridge* screenlock_bridge);
65 virtual ~EasyUnlockScreenlockStateHandler(); 64 virtual ~EasyUnlockScreenlockStateHandler();
66 65
67 // Changes internal state to |new_state| and updates the user's screenlock 66 // Changes internal state to |new_state| and updates the user's screenlock
68 // accordingly. 67 // accordingly.
69 void ChangeState(State new_state); 68 void ChangeState(State new_state);
70 69
71 // Updates the screenlock state. 70 // Updates the screenlock state.
72 void SetHardlockState(HardlockState new_state); 71 void SetHardlockState(HardlockState new_state);
73 72
74 // Shows the hardlock UI if the hardlock_state_ is not NO_HARDLOCK. 73 // Shows the hardlock UI if the hardlock_state_ is not NO_HARDLOCK.
75 void MaybeShowHardlockUI(); 74 void MaybeShowHardlockUI();
76 75
76 // Marks the current screenlock state as the one for trial Easy Unlock run.
77 void SetTrialRun();
78
77 private: 79 private:
78 // ScreenlockBridge::Observer: 80 // ScreenlockBridge::Observer:
79 virtual void OnScreenDidLock() override; 81 virtual void OnScreenDidLock() override;
80 virtual void OnScreenDidUnlock() override; 82 virtual void OnScreenDidUnlock() override;
81 virtual void OnFocusedUserChanged(const std::string& user_id) override; 83 virtual void OnFocusedUserChanged(const std::string& user_id) override;
82 84
85 // Forces refresh of the Easy Unlock screenlock UI.
86 void RefreshScreenlockState();
87
83 void ShowHardlockUI(); 88 void ShowHardlockUI();
84 89
85 // Updates icon's tooltip options. 90 // Updates icon's tooltip options.
86 // |trial_run|: Whether the trial Easy Unlock run is in progress. 91 // |trial_run|: Whether the trial Easy Unlock run is in progress.
87 void UpdateTooltipOptions( 92 void UpdateTooltipOptions(
88 bool trial_run, 93 bool trial_run,
89 ScreenlockBridge::UserPodCustomIconOptions* icon_options); 94 ScreenlockBridge::UserPodCustomIconOptions* icon_options);
90 95
91 // Whether this is the first, trial Easy Unlock run. If this is the case, a
92 // tutorial message should be shown and hard-locking be disabled in
93 // Authenticated state. The trial run will be active if Easy Unlock never
94 // entered Authenticated state (across sessions).
95 bool IsTrialRun();
96
97 // Sets user preference that marks trial run completed.
98 void MarkTrialRunComplete();
99
100 // Gets the name to be used for the device. The name depends on the device 96 // Gets the name to be used for the device. The name depends on the device
101 // type (example values: Chromebook and Chromebox). 97 // type (example values: Chromebook and Chromebox).
102 base::string16 GetDeviceName(); 98 base::string16 GetDeviceName();
103 99
104 // Updates the screenlock auth type if it has to be changed. 100 // Updates the screenlock auth type if it has to be changed.
105 void UpdateScreenlockAuthType(); 101 void UpdateScreenlockAuthType();
106 102
107 State state_; 103 State state_;
108 std::string user_email_; 104 std::string user_email_;
109 PrefService* pref_service_;
110 ScreenlockBridge* screenlock_bridge_; 105 ScreenlockBridge* screenlock_bridge_;
111 106
112 // State of hardlock. 107 // State of hardlock.
113 HardlockState hardlock_state_; 108 HardlockState hardlock_state_;
114 bool hardlock_ui_shown_; 109 bool hardlock_ui_shown_;
115 110
111 // Whether this is the trial Easy Unlock run. If this is the case, a
112 // tutorial message should be shown and hard-locking be disabled. The trial
113 // run should be set if the screen was locked by the Easy Unlock setup app.
114 bool is_trial_run_;
115
116 DISALLOW_COPY_AND_ASSIGN(EasyUnlockScreenlockStateHandler); 116 DISALLOW_COPY_AND_ASSIGN(EasyUnlockScreenlockStateHandler);
117 }; 117 };
118 118
119 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SCREENLOCK_STATE_HANDLER_H_ 119 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SCREENLOCK_STATE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698