| 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 class AccountId; |
| 21 |
| 20 namespace chromeos { | 22 namespace chromeos { |
| 21 | 23 |
| 22 // Performs initialization work for adding a new account via Easy bootstrap. | 24 // Performs initialization work for adding a new account via Easy bootstrap. |
| 23 // The class takes an authorization code then prepares a UserContext that | 25 // The class takes an authorization code then prepares a UserContext that |
| 24 // could be used to create a new account. | 26 // could be used to create a new account. |
| 25 class BootstrapUserContextInitializer final | 27 class BootstrapUserContextInitializer final |
| 26 : public gaia::GaiaOAuthClient::Delegate, | 28 : public gaia::GaiaOAuthClient::Delegate, |
| 27 public EasyUnlockServiceObserver { | 29 public EasyUnlockServiceObserver { |
| 28 public: | 30 public: |
| 29 // Callback type to be invoked after initialization work is done. | 31 // Callback type to be invoked after initialization work is done. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 45 private: | 47 private: |
| 46 void Notify(bool success); | 48 void Notify(bool success); |
| 47 | 49 |
| 48 // Starts to check existing Smart lock keys to use. | 50 // Starts to check existing Smart lock keys to use. |
| 49 void StartCheckExistingKeys(); | 51 void StartCheckExistingKeys(); |
| 50 | 52 |
| 51 void OnGetEasyUnlockData(bool success, | 53 void OnGetEasyUnlockData(bool success, |
| 52 const EasyUnlockDeviceKeyDataList& data_list); | 54 const EasyUnlockDeviceKeyDataList& data_list); |
| 53 void OnEasyUnlockAuthenticated(EasyUnlockAuthAttempt::Type auth_attempt_type, | 55 void OnEasyUnlockAuthenticated(EasyUnlockAuthAttempt::Type auth_attempt_type, |
| 54 bool success, | 56 bool success, |
| 55 const std::string& user_id, | 57 const AccountId& account_id, |
| 56 const std::string& key_secret, | 58 const std::string& key_secret, |
| 57 const std::string& key_label); | 59 const std::string& key_label); |
| 58 void CreateRandomKey(); | 60 void CreateRandomKey(); |
| 59 | 61 |
| 60 // Start refresh token and user info fetching. | 62 // Start refresh token and user info fetching. |
| 61 void StartTokenFetch(const std::string& auth_code); | 63 void StartTokenFetch(const std::string& auth_code); |
| 62 | 64 |
| 63 // gaia::GaiaOAuthClient::Delegate | 65 // gaia::GaiaOAuthClient::Delegate |
| 64 void OnGetTokensResponse(const std::string& refresh_token, | 66 void OnGetTokensResponse(const std::string& refresh_token, |
| 65 const std::string& access_token, | 67 const std::string& access_token, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 83 base::WeakPtrFactory<BootstrapUserContextInitializer> weak_ptr_factory_; | 85 base::WeakPtrFactory<BootstrapUserContextInitializer> weak_ptr_factory_; |
| 84 | 86 |
| 85 static CompleteCallback* complete_callback_for_testing_; | 87 static CompleteCallback* complete_callback_for_testing_; |
| 86 | 88 |
| 87 DISALLOW_COPY_AND_ASSIGN(BootstrapUserContextInitializer); | 89 DISALLOW_COPY_AND_ASSIGN(BootstrapUserContextInitializer); |
| 88 }; | 90 }; |
| 89 | 91 |
| 90 } // namespace chromeos | 92 } // namespace chromeos |
| 91 | 93 |
| 92 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_BOOTSTRAP_USER_CONTEXT_INIT
IALIZER_H_ | 94 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_BOOTSTRAP_USER_CONTEXT_INIT
IALIZER_H_ |
| OLD | NEW |