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_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/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 void ResetTurnOffFlow(); | 71 void ResetTurnOffFlow(); |
72 | 72 |
73 void AddObserver(EasyUnlockServiceObserver* observer); | 73 void AddObserver(EasyUnlockServiceObserver* observer); |
74 void RemoveObserver(EasyUnlockServiceObserver* observer); | 74 void RemoveObserver(EasyUnlockServiceObserver* observer); |
75 | 75 |
76 TurnOffFlowStatus turn_off_flow_status() const { | 76 TurnOffFlowStatus turn_off_flow_status() const { |
77 return turn_off_flow_status_; | 77 return turn_off_flow_status_; |
78 } | 78 } |
79 | 79 |
80 private: | 80 private: |
| 81 // A class to detect whether a bluetooth adapter is present. |
| 82 class BluetoothDetector; |
| 83 |
| 84 // Initializes the service after ExtensionService is ready. |
81 void Initialize(); | 85 void Initialize(); |
| 86 |
| 87 // Loads the Easy unlock component app. |
82 void LoadApp(); | 88 void LoadApp(); |
| 89 |
| 90 // Unloads the Easy unlock component app. |
83 void UnloadApp(); | 91 void UnloadApp(); |
| 92 |
| 93 // Checks whether Easy unlock should be running and updates app state. |
| 94 void UpdateAppState(); |
| 95 |
| 96 // Callback when the controlling pref changes. |
84 void OnPrefsChanged(); | 97 void OnPrefsChanged(); |
85 | 98 |
| 99 // Callback when Bluetooth adapter present state changes. |
| 100 void OnBluetoothAdapterPresentChanged(); |
| 101 |
| 102 // Sets the new turn-off flow status. |
86 void SetTurnOffFlowStatus(TurnOffFlowStatus status); | 103 void SetTurnOffFlowStatus(TurnOffFlowStatus status); |
| 104 |
| 105 // Callback invoked when turn off flow has finished. |
87 void OnTurnOffFlowFinished(bool success); | 106 void OnTurnOffFlowFinished(bool success); |
88 | 107 |
89 Profile* profile_; | 108 Profile* profile_; |
90 PrefChangeRegistrar registrar_; | 109 PrefChangeRegistrar registrar_; |
| 110 scoped_ptr<BluetoothDetector> bluetooth_detector_; |
91 // Created lazily in |GetScreenlockStateHandler|. | 111 // Created lazily in |GetScreenlockStateHandler|. |
92 scoped_ptr<EasyUnlockScreenlockStateHandler> screenlock_state_handler_; | 112 scoped_ptr<EasyUnlockScreenlockStateHandler> screenlock_state_handler_; |
93 | 113 |
94 TurnOffFlowStatus turn_off_flow_status_; | 114 TurnOffFlowStatus turn_off_flow_status_; |
95 scoped_ptr<EasyUnlockToggleFlow> turn_off_flow_; | 115 scoped_ptr<EasyUnlockToggleFlow> turn_off_flow_; |
96 ObserverList<EasyUnlockServiceObserver> observers_; | 116 ObserverList<EasyUnlockServiceObserver> observers_; |
97 | 117 |
98 base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_; | 118 base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_; |
99 | 119 |
100 DISALLOW_COPY_AND_ASSIGN(EasyUnlockService); | 120 DISALLOW_COPY_AND_ASSIGN(EasyUnlockService); |
101 }; | 121 }; |
102 | 122 |
103 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_ | 123 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_ |
OLD | NEW |