OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "chrome/browser/chromeos/settings/token_encryptor.h" | |
hashimoto
2013/10/04 08:38:56
nit: Can't this include replaced with a forward de
satorux1
2013/10/07 02:19:14
Done.
| |
16 #include "google_apis/gaia/gaia_oauth_client.h" | 17 #include "google_apis/gaia/gaia_oauth_client.h" |
17 #include "google_apis/gaia/oauth2_token_service.h" | 18 #include "google_apis/gaia/oauth2_token_service.h" |
18 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
19 | 20 |
20 namespace net { | 21 namespace net { |
21 class URLRequestContextGetter; | 22 class URLRequestContextGetter; |
22 } | 23 } |
23 | 24 |
24 class GoogleServiceAuthError; | 25 class GoogleServiceAuthError; |
25 class PrefRegistrySimple; | 26 class PrefRegistrySimple; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 | 62 |
62 private: | 63 private: |
63 class ValidatingConsumer; | 64 class ValidatingConsumer; |
64 friend class ValidatingConsumer; | 65 friend class ValidatingConsumer; |
65 friend class DeviceOAuth2TokenServiceFactory; | 66 friend class DeviceOAuth2TokenServiceFactory; |
66 friend class DeviceOAuth2TokenServiceTest; | 67 friend class DeviceOAuth2TokenServiceTest; |
67 friend class TestDeviceOAuth2TokenService; | 68 friend class TestDeviceOAuth2TokenService; |
68 | 69 |
69 // Use DeviceOAuth2TokenServiceFactory to get an instance of this class. | 70 // Use DeviceOAuth2TokenServiceFactory to get an instance of this class. |
70 explicit DeviceOAuth2TokenService(net::URLRequestContextGetter* getter, | 71 explicit DeviceOAuth2TokenService(net::URLRequestContextGetter* getter, |
71 PrefService* local_state); | 72 PrefService* local_state, |
73 TokenEncryptor* token_encryptor); | |
hashimoto
2013/10/04 08:38:56
nit: How about taking scoped_ptr<TokenEncryptor> a
satorux1
2013/10/07 02:19:14
Thought it's a good idea but doing it would make i
| |
72 virtual ~DeviceOAuth2TokenService(); | 74 virtual ~DeviceOAuth2TokenService(); |
73 | 75 |
74 void OnValidationComplete(bool token_is_valid); | 76 void OnValidationComplete(bool token_is_valid); |
75 | 77 |
76 bool refresh_token_is_valid_; | 78 bool refresh_token_is_valid_; |
77 int max_refresh_token_validation_retries_; | 79 int max_refresh_token_validation_retries_; |
78 | 80 |
79 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 81 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
80 | 82 |
81 // Cache the decrypted refresh token, so we only decrypt once. | 83 // Cache the decrypted refresh token, so we only decrypt once. |
82 std::string refresh_token_; | 84 std::string refresh_token_; |
83 PrefService* local_state_; | 85 PrefService* local_state_; |
86 | |
87 // Used to encrypt/decrypt the refresh token. | |
88 scoped_ptr<TokenEncryptor> token_encryptor_; | |
89 | |
84 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService); | 90 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService); |
85 }; | 91 }; |
86 | 92 |
87 } // namespace chromeos | 93 } // namespace chromeos |
88 | 94 |
89 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ | 95 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ |
OLD | NEW |