Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: chrome/browser/chromeos/settings/device_oauth2_token_service.h

Issue 25975002: cryptohome: Move Encrypt/DecryptWithSystemSalt() out of CryptohomeLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/settings/device_oauth2_token_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 10 matching lines...) Expand all
21 class URLRequestContextGetter; 21 class URLRequestContextGetter;
22 } 22 }
23 23
24 class GoogleServiceAuthError; 24 class GoogleServiceAuthError;
25 class PrefRegistrySimple; 25 class PrefRegistrySimple;
26 class PrefService; 26 class PrefService;
27 class Profile; 27 class Profile;
28 28
29 namespace chromeos { 29 namespace chromeos {
30 30
31 class TokenEncryptor;
32
31 // DeviceOAuth2TokenService retrieves OAuth2 access tokens for a given 33 // DeviceOAuth2TokenService retrieves OAuth2 access tokens for a given
32 // set of scopes using the device-level OAuth2 any-api refresh token 34 // set of scopes using the device-level OAuth2 any-api refresh token
33 // obtained during enterprise device enrollment. 35 // obtained during enterprise device enrollment.
34 // 36 //
35 // See |OAuth2TokenService| for usage details. 37 // See |OAuth2TokenService| for usage details.
36 // 38 //
37 // When using DeviceOAuth2TokenSerivce, a value of |GetRobotAccountId| should 39 // When using DeviceOAuth2TokenSerivce, a value of |GetRobotAccountId| should
38 // be used in places where API expects |account_id|. 40 // be used in places where API expects |account_id|.
39 // 41 //
40 // Note that requests must be made from the UI thread. 42 // Note that requests must be made from the UI thread.
(...skipping 19 matching lines...) Expand all
60 OAuth2TokenService::Consumer* consumer) OVERRIDE; 62 OAuth2TokenService::Consumer* consumer) OVERRIDE;
61 63
62 private: 64 private:
63 class ValidatingConsumer; 65 class ValidatingConsumer;
64 friend class ValidatingConsumer; 66 friend class ValidatingConsumer;
65 friend class DeviceOAuth2TokenServiceFactory; 67 friend class DeviceOAuth2TokenServiceFactory;
66 friend class DeviceOAuth2TokenServiceTest; 68 friend class DeviceOAuth2TokenServiceTest;
67 friend class TestDeviceOAuth2TokenService; 69 friend class TestDeviceOAuth2TokenService;
68 70
69 // Use DeviceOAuth2TokenServiceFactory to get an instance of this class. 71 // Use DeviceOAuth2TokenServiceFactory to get an instance of this class.
72 // Ownership of |token_encryptor| will be taken.
70 explicit DeviceOAuth2TokenService(net::URLRequestContextGetter* getter, 73 explicit DeviceOAuth2TokenService(net::URLRequestContextGetter* getter,
71 PrefService* local_state); 74 PrefService* local_state,
75 TokenEncryptor* token_encryptor);
72 virtual ~DeviceOAuth2TokenService(); 76 virtual ~DeviceOAuth2TokenService();
73 77
74 void OnValidationComplete(bool token_is_valid); 78 void OnValidationComplete(bool token_is_valid);
75 79
76 bool refresh_token_is_valid_; 80 bool refresh_token_is_valid_;
77 int max_refresh_token_validation_retries_; 81 int max_refresh_token_validation_retries_;
78 82
79 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 83 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
80 84
81 // Cache the decrypted refresh token, so we only decrypt once. 85 // Cache the decrypted refresh token, so we only decrypt once.
82 std::string refresh_token_; 86 std::string refresh_token_;
83 PrefService* local_state_; 87 PrefService* local_state_;
88
89 // Used to encrypt/decrypt the refresh token.
90 scoped_ptr<TokenEncryptor> token_encryptor_;
91
84 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService); 92 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService);
85 }; 93 };
86 94
87 } // namespace chromeos 95 } // namespace chromeos
88 96
89 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ 97 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/settings/device_oauth2_token_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698