| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SIGNIN_TOKEN_HANDLE_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 class TokenDelegate : public gaia::GaiaOAuthClient::Delegate { | 61 class TokenDelegate : public gaia::GaiaOAuthClient::Delegate { |
| 62 public: | 62 public: |
| 63 TokenDelegate(const base::WeakPtr<TokenHandleUtil>& owner, | 63 TokenDelegate(const base::WeakPtr<TokenHandleUtil>& owner, |
| 64 const AccountId& account_id, | 64 const AccountId& account_id, |
| 65 const std::string& token, | 65 const std::string& token, |
| 66 const TokenValidationCallback& callback); | 66 const TokenValidationCallback& callback); |
| 67 ~TokenDelegate() override; | 67 ~TokenDelegate() override; |
| 68 void OnOAuthError() override; | 68 void OnOAuthError() override; |
| 69 void OnNetworkError(int response_code) override; | 69 void OnNetworkError(int response_code) override; |
| 70 void OnGetTokenInfoResponse( | 70 void OnGetTokenInfoResponse( |
| 71 scoped_ptr<base::DictionaryValue> token_info) override; | 71 std::unique_ptr<base::DictionaryValue> token_info) override; |
| 72 void NotifyDone(); | 72 void NotifyDone(); |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 base::WeakPtr<TokenHandleUtil> owner_; | 75 base::WeakPtr<TokenHandleUtil> owner_; |
| 76 AccountId account_id_; | 76 AccountId account_id_; |
| 77 std::string token_; | 77 std::string token_; |
| 78 base::TimeTicks tokeninfo_response_start_time_; | 78 base::TimeTicks tokeninfo_response_start_time_; |
| 79 TokenValidationCallback callback_; | 79 TokenValidationCallback callback_; |
| 80 | 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(TokenDelegate); | 81 DISALLOW_COPY_AND_ASSIGN(TokenDelegate); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 void OnValidationComplete(const std::string& token); | 84 void OnValidationComplete(const std::string& token); |
| 85 void OnObtainTokenComplete(const AccountId& account_id); | 85 void OnObtainTokenComplete(const AccountId& account_id); |
| 86 | 86 |
| 87 // Map of pending check operations. | 87 // Map of pending check operations. |
| 88 base::ScopedPtrHashMap<std::string, scoped_ptr<TokenDelegate>> | 88 base::ScopedPtrHashMap<std::string, std::unique_ptr<TokenDelegate>> |
| 89 validation_delegates_; | 89 validation_delegates_; |
| 90 | 90 |
| 91 // Map of pending obtain operations. | 91 // Map of pending obtain operations. |
| 92 base::ScopedPtrHashMap<AccountId, scoped_ptr<TokenDelegate>> | 92 base::ScopedPtrHashMap<AccountId, std::unique_ptr<TokenDelegate>> |
| 93 obtain_delegates_; | 93 obtain_delegates_; |
| 94 | 94 |
| 95 // Instance of GAIA Client. | 95 // Instance of GAIA Client. |
| 96 scoped_ptr<gaia::GaiaOAuthClient> gaia_client_; | 96 std::unique_ptr<gaia::GaiaOAuthClient> gaia_client_; |
| 97 | 97 |
| 98 base::WeakPtrFactory<TokenHandleUtil> weak_factory_; | 98 base::WeakPtrFactory<TokenHandleUtil> weak_factory_; |
| 99 | 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(TokenHandleUtil); | 100 DISALLOW_COPY_AND_ASSIGN(TokenHandleUtil); |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ | 103 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ |
| OLD | NEW |