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

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

Issue 475483003: Wire easy unlock settings UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
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 "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/observer_list.h"
10 #include "base/prefs/pref_change_registrar.h" 12 #include "base/prefs/pref_change_registrar.h"
11 #include "components/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/keyed_service.h"
12 14
15 namespace base {
16 class DictionaryValue;
17 class ListValue;
18 }
19
13 namespace user_prefs { 20 namespace user_prefs {
14 class PrefRegistrySyncable; 21 class PrefRegistrySyncable;
15 } 22 }
16 23
17 class EasyUnlockScreenlockStateHandler; 24 class EasyUnlockScreenlockStateHandler;
25 class EasyUnlockServiceObserver;
26 class EasyUnlockToggleFlow;
18 class Profile; 27 class Profile;
19 28
20 class EasyUnlockService : public KeyedService { 29 class EasyUnlockService : public KeyedService {
21 public: 30 public:
31 enum TurnOffFlowStatus {
32 IDLE,
33 PENDING,
34 FAIL,
35 };
36
22 explicit EasyUnlockService(Profile* profile); 37 explicit EasyUnlockService(Profile* profile);
23 virtual ~EasyUnlockService(); 38 virtual ~EasyUnlockService();
24 39
25 // Gets EasyUnlockService instance. 40 // Gets EasyUnlockService instance.
26 static EasyUnlockService* Get(Profile* profile); 41 static EasyUnlockService* Get(Profile* profile);
27 42
28 // Registers Easy Unlock profile preferences. 43 // Registers Easy Unlock profile preferences.
29 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 44 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
30 45
31 // Launches Easy Unlock Setup app. 46 // Launches Easy Unlock Setup app.
32 void LaunchSetup(); 47 void LaunchSetup();
33 48
34 // Whether easy unlock is allowed to be used. If the controlling preference 49 // Whether easy unlock is allowed to be used. If the controlling preference
35 // is set (from policy), this returns the preference value. Otherwise, it is 50 // is set (from policy), this returns the preference value. Otherwise, it is
36 // permitted either the flag is enabled or its field trial is enabled. 51 // permitted either the flag is enabled or its field trial is enabled.
37 bool IsAllowed(); 52 bool IsAllowed();
38 53
39 // Gets |screenlock_state_handler_|. Returns NULL if Easy Unlock is not 54 // Gets |screenlock_state_handler_|. Returns NULL if Easy Unlock is not
40 // allowed. Otherwise, if |screenlock_state_handler_| is not set, an instance 55 // allowed. Otherwise, if |screenlock_state_handler_| is not set, an instance
41 // is created. Do not cache the returned value, as it may go away if Easy 56 // is created. Do not cache the returned value, as it may go away if Easy
42 // Unlock gets disabled. 57 // Unlock gets disabled.
43 EasyUnlockScreenlockStateHandler* GetScreenlockStateHandler(); 58 EasyUnlockScreenlockStateHandler* GetScreenlockStateHandler();
44 59
60 // Gets/Sets/Clears the permit access for the local device.
61 const base::DictionaryValue* GetPermitAccess() const;
62 void SetPermitAccess(const base::DictionaryValue& permit);
63 void ClearPermitAccess();
64
65 // Gets/Sets/Clears the remote devices list.
66 const base::ListValue* GetRemoteDevices() const;
67 void SetRemoteDevices(const base::ListValue& devices);
68 void ClearRemoteDevices();
69
70 void RunTurnOffFlow();
71 void ResetTurnOffFlow();
72
73 void AddObserver(EasyUnlockServiceObserver* observer);
74 void RemoveObserver(EasyUnlockServiceObserver* observer);
75
76 TurnOffFlowStatus turn_off_flow_status() const {
77 return turn_off_flow_status_;
78 }
79
45 private: 80 private:
46 void Initialize(); 81 void Initialize();
47 void LoadApp(); 82 void LoadApp();
48 void UnloadApp(); 83 void UnloadApp();
49 void OnPrefsChanged(); 84 void OnPrefsChanged();
50 85
86 void SetTurnOffFlowStatus(TurnOffFlowStatus status);
87 void OnTurnOffFlowFinished(bool success);
88
51 Profile* profile_; 89 Profile* profile_;
52 PrefChangeRegistrar registrar_; 90 PrefChangeRegistrar registrar_;
53 // Created lazily in |GetScreenlockStateHandler|. 91 // Created lazily in |GetScreenlockStateHandler|.
54 scoped_ptr<EasyUnlockScreenlockStateHandler> screenlock_state_handler_; 92 scoped_ptr<EasyUnlockScreenlockStateHandler> screenlock_state_handler_;
93
94 TurnOffFlowStatus turn_off_flow_status_;
95 scoped_ptr<EasyUnlockToggleFlow> turn_off_flow_;
96 ObserverList<EasyUnlockServiceObserver> observers_;
97
55 base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_; 98 base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_;
56 99
57 DISALLOW_COPY_AND_ASSIGN(EasyUnlockService); 100 DISALLOW_COPY_AND_ASSIGN(EasyUnlockService);
58 }; 101 };
59 102
60 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_ 103 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/easy_unlock_turn_off_overlay.js ('k') | chrome/browser/signin/easy_unlock_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698