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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "chrome/browser/signin/chrome_proximity_auth_client.h" | 16 #include "chrome/browser/signin/chrome_proximity_auth_client.h" |
17 #include "chrome/browser/signin/easy_unlock_auth_attempt.h" | 17 #include "chrome/browser/signin/easy_unlock_auth_attempt.h" |
18 #include "chrome/browser/signin/easy_unlock_metrics.h" | 18 #include "chrome/browser/signin/easy_unlock_metrics.h" |
19 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" | 19 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" |
20 #include "components/keyed_service/core/keyed_service.h" | 20 #include "components/keyed_service/core/keyed_service.h" |
21 #include "components/proximity_auth/screenlock_state.h" | 21 #include "components/proximity_auth/screenlock_state.h" |
22 #include "components/proximity_auth/webui/proximity_auth_ui_delegate.h" | |
23 | 22 |
24 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
25 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h" | 24 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h" |
26 #endif | 25 #endif |
27 | 26 |
28 namespace base { | 27 namespace base { |
29 class DictionaryValue; | 28 class DictionaryValue; |
30 class ListValue; | 29 class ListValue; |
31 } | 30 } |
32 | 31 |
33 namespace user_manager { | 32 namespace user_manager { |
34 class User; | 33 class User; |
35 } | 34 } |
36 | 35 |
37 namespace user_prefs { | 36 namespace user_prefs { |
38 class PrefRegistrySyncable; | 37 class PrefRegistrySyncable; |
39 } | 38 } |
40 | 39 |
41 namespace proximity_auth { | 40 namespace proximity_auth { |
42 class ProximityAuthBleSystem; | 41 class ProximityAuthBleSystem; |
43 } | 42 } |
44 | 43 |
45 class EasyUnlockAppManager; | 44 class EasyUnlockAppManager; |
46 class EasyUnlockServiceObserver; | 45 class EasyUnlockServiceObserver; |
47 class Profile; | 46 class Profile; |
48 class PrefRegistrySimple; | 47 class PrefRegistrySimple; |
49 | 48 |
50 class EasyUnlockService : public KeyedService, | 49 class EasyUnlockService : public KeyedService { |
51 public proximity_auth::ProximityAuthUIDelegate { | |
52 public: | 50 public: |
53 enum TurnOffFlowStatus { | 51 enum TurnOffFlowStatus { |
54 IDLE, | 52 IDLE, |
55 PENDING, | 53 PENDING, |
56 FAIL, | 54 FAIL, |
57 }; | 55 }; |
58 | 56 |
59 enum Type { | 57 enum Type { |
60 TYPE_REGULAR, | 58 TYPE_REGULAR, |
61 TYPE_SIGNIN | 59 TYPE_SIGNIN |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // trial run initiated by Easy Unlock app. | 212 // trial run initiated by Easy Unlock app. |
215 void SetTrialRun(); | 213 void SetTrialRun(); |
216 | 214 |
217 // Records that the user clicked on the lock icon during the trial run | 215 // Records that the user clicked on the lock icon during the trial run |
218 // initiated by the Easy Unlock app. | 216 // initiated by the Easy Unlock app. |
219 void RecordClickOnLockIcon(); | 217 void RecordClickOnLockIcon(); |
220 | 218 |
221 void AddObserver(EasyUnlockServiceObserver* observer); | 219 void AddObserver(EasyUnlockServiceObserver* observer); |
222 void RemoveObserver(EasyUnlockServiceObserver* observer); | 220 void RemoveObserver(EasyUnlockServiceObserver* observer); |
223 | 221 |
224 // ProximityAuthUIDelegate: | |
225 PrefService* GetPrefService() override; | |
226 scoped_ptr<proximity_auth::SecureMessageDelegate> | |
227 CreateSecureMessageDelegate() override; | |
228 scoped_ptr<proximity_auth::CryptAuthClientFactory> | |
229 CreateCryptAuthClientFactory() override; | |
230 cryptauth::DeviceClassifier GetDeviceClassifier() override; | |
231 std::string GetAccountId() override; | |
232 gcm::GCMDriver* GetGCMDriver() override; | |
233 | |
234 ChromeProximityAuthClient* proximity_auth_client() { | 222 ChromeProximityAuthClient* proximity_auth_client() { |
235 return &proximity_auth_client_; | 223 return &proximity_auth_client_; |
236 } | 224 } |
237 | 225 |
238 protected: | 226 protected: |
239 explicit EasyUnlockService(Profile* profile); | 227 explicit EasyUnlockService(Profile* profile); |
240 ~EasyUnlockService() override; | 228 ~EasyUnlockService() override; |
241 | 229 |
242 // Does a service type specific initialization. | 230 // Does a service type specific initialization. |
243 virtual void InitializeInternal() = 0; | 231 virtual void InitializeInternal() = 0; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 bool tpm_key_checked_; | 358 bool tpm_key_checked_; |
371 | 359 |
372 base::ObserverList<EasyUnlockServiceObserver> observers_; | 360 base::ObserverList<EasyUnlockServiceObserver> observers_; |
373 | 361 |
374 base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_; | 362 base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_; |
375 | 363 |
376 DISALLOW_COPY_AND_ASSIGN(EasyUnlockService); | 364 DISALLOW_COPY_AND_ASSIGN(EasyUnlockService); |
377 }; | 365 }; |
378 | 366 |
379 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_ | 367 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_ |
OLD | NEW |