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_SIGNIN_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_SIGNIN_CHROMEOS_H_ |
6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_SIGNIN_CHROMEOS_H_ | 6 #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_SIGNIN_CHROMEOS_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" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h" |
11 #include "chrome/browser/signin/easy_unlock_service.h" | 14 #include "chrome/browser/signin/easy_unlock_service.h" |
12 | 15 |
| 16 namespace base { |
| 17 class DictionaryValue; |
| 18 class ListValue; |
| 19 } |
| 20 |
13 // EasyUnlockService instance that should be used for signin profile. | 21 // EasyUnlockService instance that should be used for signin profile. |
14 class EasyUnlockServiceSignin : public EasyUnlockService { | 22 class EasyUnlockServiceSignin : public EasyUnlockService { |
15 public: | 23 public: |
16 explicit EasyUnlockServiceSignin(Profile* profile); | 24 explicit EasyUnlockServiceSignin(Profile* profile); |
17 virtual ~EasyUnlockServiceSignin(); | 25 virtual ~EasyUnlockServiceSignin(); |
18 | 26 |
| 27 void SetAssociatedUser(const std::string& user_id); |
| 28 |
19 private: | 29 private: |
20 // EasyUnlockService implementation: | 30 // EasyUnlockService implementation: |
21 virtual EasyUnlockService::Type GetType() const OVERRIDE; | 31 virtual EasyUnlockService::Type GetType() const OVERRIDE; |
22 virtual std::string GetUserEmail() const OVERRIDE; | 32 virtual std::string GetUserEmail() const OVERRIDE; |
23 virtual void LaunchSetup() OVERRIDE; | 33 virtual void LaunchSetup() OVERRIDE; |
24 virtual const base::DictionaryValue* GetPermitAccess() const OVERRIDE; | 34 virtual const base::DictionaryValue* GetPermitAccess() const OVERRIDE; |
25 virtual void SetPermitAccess(const base::DictionaryValue& permit) OVERRIDE; | 35 virtual void SetPermitAccess(const base::DictionaryValue& permit) OVERRIDE; |
26 virtual void ClearPermitAccess() OVERRIDE; | 36 virtual void ClearPermitAccess() OVERRIDE; |
27 virtual const base::ListValue* GetRemoteDevices() const OVERRIDE; | 37 virtual const base::ListValue* GetRemoteDevices() const OVERRIDE; |
28 virtual void SetRemoteDevices(const base::ListValue& devices) OVERRIDE; | 38 virtual void SetRemoteDevices(const base::ListValue& devices) OVERRIDE; |
29 virtual void ClearRemoteDevices() OVERRIDE; | 39 virtual void ClearRemoteDevices() OVERRIDE; |
30 virtual void RunTurnOffFlow() OVERRIDE; | 40 virtual void RunTurnOffFlow() OVERRIDE; |
31 virtual void ResetTurnOffFlow() OVERRIDE; | 41 virtual void ResetTurnOffFlow() OVERRIDE; |
32 virtual TurnOffFlowStatus GetTurnOffFlowStatus() const OVERRIDE; | 42 virtual TurnOffFlowStatus GetTurnOffFlowStatus() const OVERRIDE; |
| 43 virtual std::string GetChallenge() const OVERRIDE; |
33 virtual bool IsAllowedInternal() OVERRIDE; | 44 virtual bool IsAllowedInternal() OVERRIDE; |
34 virtual void InitializeInternal() OVERRIDE; | 45 virtual void InitializeInternal() OVERRIDE; |
35 | 46 |
| 47 // Fetches |remote_devices_| info from cryptohome keys. |
| 48 void FetchCryptohomeKeys(); |
| 49 |
| 50 // Callback invoked when the cryptohome keys are fetched. |
| 51 void OnCryptohomeKeysFetched( |
| 52 bool success, |
| 53 const chromeos::EasyUnlockDeviceKeyDataList& devices); |
| 54 |
| 55 // User id of the associated user. |
| 56 std::string user_id_; |
| 57 |
| 58 // Remote devices of the associated user. |
| 59 chromeos::EasyUnlockDeviceKeyDataList remote_devices_; |
| 60 scoped_ptr<base::ListValue> remote_devices_value_; |
| 61 |
| 62 base::WeakPtrFactory<EasyUnlockServiceSignin> weak_ptr_factory_; |
| 63 |
36 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceSignin); | 64 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceSignin); |
37 }; | 65 }; |
38 | 66 |
39 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_SIGNIN_CHROMEOS_H_ | 67 #endif // CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_SIGNIN_CHROMEOS_H_ |
OLD | NEW |