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_CHROMEOS_LOGIN_EASY_UNLOCK_BOOTSTRAP_USER_CONTEXT_INITIAL
IZER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_BOOTSTRAP_USER_CONTEXT_INITIAL
IZER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_BOOTSTRAP_USER_CONTEXT_INITIAL
IZER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_BOOTSTRAP_USER_CONTEXT_INITIAL
IZER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h" | 14 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h" |
15 #include "chrome/browser/signin/easy_unlock_auth_attempt.h" | 15 #include "chrome/browser/signin/easy_unlock_auth_attempt.h" |
16 #include "chrome/browser/signin/easy_unlock_service_observer.h" | 16 #include "chrome/browser/signin/easy_unlock_service_observer.h" |
17 #include "chromeos/login/auth/user_context.h" | 17 #include "chromeos/login/auth/user_context.h" |
18 #include "google_apis/gaia/gaia_oauth_client.h" | 18 #include "google_apis/gaia/gaia_oauth_client.h" |
19 | 19 |
| 20 namespace user_manager { |
| 21 class UserID; |
| 22 } |
| 23 |
20 namespace chromeos { | 24 namespace chromeos { |
21 | 25 |
22 // Performs initialization work for adding a new account via Easy bootstrap. | 26 // Performs initialization work for adding a new account via Easy bootstrap. |
23 // The class takes an authorization code then prepares a UserContext that | 27 // The class takes an authorization code then prepares a UserContext that |
24 // could be used to create a new account. | 28 // could be used to create a new account. |
25 class BootstrapUserContextInitializer final | 29 class BootstrapUserContextInitializer final |
26 : public gaia::GaiaOAuthClient::Delegate, | 30 : public gaia::GaiaOAuthClient::Delegate, |
27 public EasyUnlockServiceObserver { | 31 public EasyUnlockServiceObserver { |
28 public: | 32 public: |
29 // Callback type to be invoked after initialization work is done. | 33 // Callback type to be invoked after initialization work is done. |
(...skipping 15 matching lines...) Expand all Loading... |
45 private: | 49 private: |
46 void Notify(bool success); | 50 void Notify(bool success); |
47 | 51 |
48 // Starts to check existing Smart lock keys to use. | 52 // Starts to check existing Smart lock keys to use. |
49 void StartCheckExistingKeys(); | 53 void StartCheckExistingKeys(); |
50 | 54 |
51 void OnGetEasyUnlockData(bool success, | 55 void OnGetEasyUnlockData(bool success, |
52 const EasyUnlockDeviceKeyDataList& data_list); | 56 const EasyUnlockDeviceKeyDataList& data_list); |
53 void OnEasyUnlockAuthenticated(EasyUnlockAuthAttempt::Type auth_attempt_type, | 57 void OnEasyUnlockAuthenticated(EasyUnlockAuthAttempt::Type auth_attempt_type, |
54 bool success, | 58 bool success, |
55 const std::string& user_id, | 59 const user_manager::UserID& user_id, |
56 const std::string& key_secret, | 60 const std::string& key_secret, |
57 const std::string& key_label); | 61 const std::string& key_label); |
58 void CreateRandomKey(); | 62 void CreateRandomKey(); |
59 | 63 |
60 // Start refresh token and user info fetching. | 64 // Start refresh token and user info fetching. |
61 void StartTokenFetch(const std::string& auth_code); | 65 void StartTokenFetch(const std::string& auth_code); |
62 | 66 |
63 // gaia::GaiaOAuthClient::Delegate | 67 // gaia::GaiaOAuthClient::Delegate |
64 void OnGetTokensResponse(const std::string& refresh_token, | 68 void OnGetTokensResponse(const std::string& refresh_token, |
65 const std::string& access_token, | 69 const std::string& access_token, |
(...skipping 17 matching lines...) Expand all Loading... |
83 base::WeakPtrFactory<BootstrapUserContextInitializer> weak_ptr_factory_; | 87 base::WeakPtrFactory<BootstrapUserContextInitializer> weak_ptr_factory_; |
84 | 88 |
85 static CompleteCallback* complete_callback_for_testing_; | 89 static CompleteCallback* complete_callback_for_testing_; |
86 | 90 |
87 DISALLOW_COPY_AND_ASSIGN(BootstrapUserContextInitializer); | 91 DISALLOW_COPY_AND_ASSIGN(BootstrapUserContextInitializer); |
88 }; | 92 }; |
89 | 93 |
90 } // namespace chromeos | 94 } // namespace chromeos |
91 | 95 |
92 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_BOOTSTRAP_USER_CONTEXT_INIT
IALIZER_H_ | 96 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_BOOTSTRAP_USER_CONTEXT_INIT
IALIZER_H_ |
OLD | NEW |