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_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
12 #include "base/macros.h" | 13 #include "base/macros.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/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "chrome/browser/chromeos/settings/cros_settings.h" | 16 #include "chrome/browser/chromeos/settings/cros_settings.h" |
17 #include "google_apis/gaia/gaia_oauth_client.h" | 17 #include "google_apis/gaia/gaia_oauth_client.h" |
18 #include "google_apis/gaia/oauth2_token_service_delegate.h" | 18 #include "google_apis/gaia/oauth2_token_service_delegate.h" |
19 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
20 | 20 |
21 namespace gaia { | 21 namespace gaia { |
22 class GaiaOAuthClient; | 22 class GaiaOAuthClient; |
23 } | 23 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( | 57 OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( |
58 const std::string& account_id, | 58 const std::string& account_id, |
59 net::URLRequestContextGetter* getter, | 59 net::URLRequestContextGetter* getter, |
60 OAuth2AccessTokenConsumer* consumer) override; | 60 OAuth2AccessTokenConsumer* consumer) override; |
61 | 61 |
62 // gaia::GaiaOAuthClient::Delegate implementation. | 62 // gaia::GaiaOAuthClient::Delegate implementation. |
63 void OnRefreshTokenResponse(const std::string& access_token, | 63 void OnRefreshTokenResponse(const std::string& access_token, |
64 int expires_in_seconds) override; | 64 int expires_in_seconds) override; |
65 void OnGetTokenInfoResponse( | 65 void OnGetTokenInfoResponse( |
66 scoped_ptr<base::DictionaryValue> token_info) override; | 66 std::unique_ptr<base::DictionaryValue> token_info) override; |
67 void OnOAuthError() override; | 67 void OnOAuthError() override; |
68 void OnNetworkError(int response_code) override; | 68 void OnNetworkError(int response_code) override; |
69 | 69 |
70 class ValidationStatusDelegate { | 70 class ValidationStatusDelegate { |
71 public: | 71 public: |
72 virtual void OnValidationCompleted(GoogleServiceAuthError::State error) {} | 72 virtual void OnValidationCompleted(GoogleServiceAuthError::State error) {} |
73 }; | 73 }; |
74 | 74 |
75 private: | 75 private: |
76 friend class DeviceOAuth2TokenService; | 76 friend class DeviceOAuth2TokenService; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 // Flag to indicate whether there are pending requests. | 139 // Flag to indicate whether there are pending requests. |
140 bool validation_requested_; | 140 bool validation_requested_; |
141 | 141 |
142 // Validation status delegate | 142 // Validation status delegate |
143 ValidationStatusDelegate* validation_status_delegate_; | 143 ValidationStatusDelegate* validation_status_delegate_; |
144 | 144 |
145 // Cache the decrypted refresh token, so we only decrypt once. | 145 // Cache the decrypted refresh token, so we only decrypt once. |
146 std::string refresh_token_; | 146 std::string refresh_token_; |
147 | 147 |
148 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 148 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
149 | 149 |
150 scoped_ptr<CrosSettings::ObserverSubscription> | 150 std::unique_ptr<CrosSettings::ObserverSubscription> |
151 service_account_identity_subscription_; | 151 service_account_identity_subscription_; |
152 | 152 |
153 base::WeakPtrFactory<DeviceOAuth2TokenServiceDelegate> weak_ptr_factory_; | 153 base::WeakPtrFactory<DeviceOAuth2TokenServiceDelegate> weak_ptr_factory_; |
154 | 154 |
155 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenServiceDelegate); | 155 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenServiceDelegate); |
156 }; | 156 }; |
157 | 157 |
158 } // namespace chromeos | 158 } // namespace chromeos |
159 | 159 |
160 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_DELEGATE
_H_ | 160 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_DELEGATE
_H_ |
OLD | NEW |