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

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

Issue 608693006: [Easy Unlock] When hardlocking, show a different icon on user (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_
6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_ 6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" 14 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h"
15 #include "components/keyed_service/core/keyed_service.h" 15 #include "components/keyed_service/core/keyed_service.h"
16 16
17 namespace base { 17 namespace base {
18 class DictionaryValue; 18 class DictionaryValue;
19 class ListValue; 19 class ListValue;
20 } 20 }
21 21
22 namespace user_manager {
23 class User;
24 }
25
22 namespace user_prefs { 26 namespace user_prefs {
23 class PrefRegistrySyncable; 27 class PrefRegistrySyncable;
24 } 28 }
25 29
26 class EasyUnlockAuthAttempt; 30 class EasyUnlockAuthAttempt;
27 class EasyUnlockServiceObserver; 31 class EasyUnlockServiceObserver;
28 class Profile; 32 class Profile;
29 33
30 class EasyUnlockService : public KeyedService { 34 class EasyUnlockService : public KeyedService {
31 public: 35 public:
32 enum TurnOffFlowStatus { 36 enum TurnOffFlowStatus {
33 IDLE, 37 IDLE,
34 PENDING, 38 PENDING,
35 FAIL, 39 FAIL,
36 }; 40 };
37 41
38 enum Type { 42 enum Type {
39 TYPE_REGULAR, 43 TYPE_REGULAR,
40 TYPE_SIGNIN 44 TYPE_SIGNIN
41 }; 45 };
42 46
43 // Gets EasyUnlockService instance. 47 // Gets EasyUnlockService instance.
44 static EasyUnlockService* Get(Profile* profile); 48 static EasyUnlockService* Get(Profile* profile);
45 49
50 // Gets EasyUnlockService instance associated with a user if the user is
51 // logged in and his profile is initialized.
52 static EasyUnlockService* GetForUser(const user_manager::User& user);
53
46 // Registers Easy Unlock profile preferences. 54 // Registers Easy Unlock profile preferences.
47 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 55 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
48 56
49 // Returns the EasyUnlockService type. 57 // Returns the EasyUnlockService type.
50 virtual Type GetType() const = 0; 58 virtual Type GetType() const = 0;
51 59
52 // Returns the user currently associated with the service. 60 // Returns the user currently associated with the service.
53 virtual std::string GetUserEmail() const = 0; 61 virtual std::string GetUserEmail() const = 0;
54 62
55 // Launches Easy Unlock Setup app. 63 // Launches Easy Unlock Setup app.
56 virtual void LaunchSetup() = 0; 64 virtual void LaunchSetup() = 0;
57 65
58 // Gets/Sets/Clears the permit access for the local device. 66 // Gets/Sets/Clears the permit access for the local device.
59 virtual const base::DictionaryValue* GetPermitAccess() const = 0; 67 virtual const base::DictionaryValue* GetPermitAccess() const = 0;
60 virtual void SetPermitAccess(const base::DictionaryValue& permit) = 0; 68 virtual void SetPermitAccess(const base::DictionaryValue& permit) = 0;
61 virtual void ClearPermitAccess() = 0; 69 virtual void ClearPermitAccess() = 0;
62 70
63 // Gets/Sets/Clears the remote devices list. 71 // Gets/Sets/Clears the remote devices list.
64 virtual const base::ListValue* GetRemoteDevices() const = 0; 72 virtual const base::ListValue* GetRemoteDevices() const = 0;
65 virtual void SetRemoteDevices(const base::ListValue& devices) = 0; 73 virtual void SetRemoteDevices(const base::ListValue& devices) = 0;
66 virtual void ClearRemoteDevices() = 0; 74 virtual void ClearRemoteDevices() = 0;
67 75
76 // Hardlocks the service for the associated user.
77 virtual void SetHardlocked(bool value) = 0;
78
79 // Whether the Easy Unlock service is hardlocked for the associated user.
80 virtual bool IsHardlocked() const = 0;
81
68 // Runs the flow for turning Easy unlock off. 82 // Runs the flow for turning Easy unlock off.
69 virtual void RunTurnOffFlow() = 0; 83 virtual void RunTurnOffFlow() = 0;
70 84
71 // Resets the turn off flow if one is in progress. 85 // Resets the turn off flow if one is in progress.
72 virtual void ResetTurnOffFlow() = 0; 86 virtual void ResetTurnOffFlow() = 0;
73 87
74 // Returns the current turn off flow status. 88 // Returns the current turn off flow status.
75 virtual TurnOffFlowStatus GetTurnOffFlowStatus() const = 0; 89 virtual TurnOffFlowStatus GetTurnOffFlowStatus() const = 0;
76 90
77 // Gets the challenge bytes for the user currently associated with the 91 // Gets the challenge bytes for the user currently associated with the
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 163
150 // Notifies the easy unlock app that the user state has been updated. 164 // Notifies the easy unlock app that the user state has been updated.
151 void NotifyUserUpdated(); 165 void NotifyUserUpdated();
152 166
153 // Notifies observers that the turn off flow status changed. 167 // Notifies observers that the turn off flow status changed.
154 void NotifyTurnOffOperationStatusChanged(); 168 void NotifyTurnOffOperationStatusChanged();
155 169
156 // Resets the screenlock state set by this service. 170 // Resets the screenlock state set by this service.
157 void ResetScreenlockState(); 171 void ResetScreenlockState();
158 172
173 // Updates |screenlock_state_handler_|'s hardlocked state.
174 void SetScreenlockHardlockedState(bool value);
175
159 private: 176 private:
160 // A class to detect whether a bluetooth adapter is present. 177 // A class to detect whether a bluetooth adapter is present.
161 class BluetoothDetector; 178 class BluetoothDetector;
162 179
163 // Initializes the service after ExtensionService is ready. 180 // Initializes the service after ExtensionService is ready.
164 void Initialize(); 181 void Initialize();
165 182
166 // Gets |screenlock_state_handler_|. Returns NULL if Easy Unlock is not 183 // Gets |screenlock_state_handler_|. Returns NULL if Easy Unlock is not
167 // allowed. Otherwise, if |screenlock_state_handler_| is not set, an instance 184 // allowed. Otherwise, if |screenlock_state_handler_| is not set, an instance
168 // is created. Do not cache the returned value, as it may go away if Easy 185 // is created. Do not cache the returned value, as it may go away if Easy
(...skipping 24 matching lines...) Expand all
193 bool shut_down_; 210 bool shut_down_;
194 211
195 ObserverList<EasyUnlockServiceObserver> observers_; 212 ObserverList<EasyUnlockServiceObserver> observers_;
196 213
197 base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_; 214 base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_;
198 215
199 DISALLOW_COPY_AND_ASSIGN(EasyUnlockService); 216 DISALLOW_COPY_AND_ASSIGN(EasyUnlockService);
200 }; 217 };
201 218
202 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_ 219 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc ('k') | chrome/browser/signin/easy_unlock_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698