Chromium Code Reviews| 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 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 // set of scopes using the device-level OAuth2 any-api refresh token | 32 // set of scopes using the device-level OAuth2 any-api refresh token |
| 33 // obtained during enterprise device enrollment. | 33 // obtained during enterprise device enrollment. |
| 34 // | 34 // |
| 35 // See |OAuth2TokenService| for usage details. | 35 // See |OAuth2TokenService| for usage details. |
| 36 // | 36 // |
| 37 // Note that requests must be made from the UI thread. | 37 // Note that requests must be made from the UI thread. |
| 38 class DeviceOAuth2TokenService : public OAuth2TokenService { | 38 class DeviceOAuth2TokenService : public OAuth2TokenService { |
| 39 public: | 39 public: |
| 40 // Specialization of StartRequest that in parallel validates that the refresh | 40 // Specialization of StartRequest that in parallel validates that the refresh |
| 41 // token stored on the device is owned by the device service account. | 41 // token stored on the device is owned by the device service account. |
| 42 virtual scoped_ptr<Request> StartRequest(const ScopeSet& scopes, | 42 virtual scoped_ptr<Request> StartRequest(const std::string& account_id, |
|
Andrew T Wilson (Slow)
2013/08/30 10:47:00
Can you add a TODO and file a bug to not OVERRIDE
fgorski
2013/08/30 20:10:16
Done. crbug.com/282454
| |
| 43 const ScopeSet& scopes, | |
| 43 Consumer* consumer) OVERRIDE; | 44 Consumer* consumer) OVERRIDE; |
| 44 | 45 |
| 45 // Persist the given refresh token on the device. Overwrites any previous | 46 // Persist the given refresh token on the device. Overwrites any previous |
| 46 // value. Should only be called during initial device setup. | 47 // value. Should only be called during initial device setup. |
| 47 void SetAndSaveRefreshToken(const std::string& refresh_token); | 48 void SetAndSaveRefreshToken(const std::string& refresh_token); |
| 48 | 49 |
| 49 static void RegisterPrefs(PrefRegistrySimple* registry); | 50 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 50 | 51 |
| 51 virtual std::string GetRefreshToken() OVERRIDE; | 52 virtual std::string GetRefreshToken(const std::string& account_id) OVERRIDE; |
|
Andrew T Wilson (Slow)
2013/08/30 10:47:00
Document that account_id *must* be empty since we
fgorski
2013/08/30 20:10:16
I went with your comment to introduce GetDeviceAcc
| |
| 52 | 53 |
| 53 protected: | 54 protected: |
| 54 // Pull the robot account ID from device policy. | 55 // Pull the robot account ID from device policy. |
| 55 virtual std::string GetRobotAccountId(); | 56 virtual std::string GetRobotAccountId(); |
| 56 | 57 |
| 57 // Implementation of OAuth2TokenService. | 58 // Implementation of OAuth2TokenService. |
| 58 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; | 59 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 class ValidatingConsumer; | 62 class ValidatingConsumer; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 78 | 79 |
| 79 // Cache the decrypted refresh token, so we only decrypt once. | 80 // Cache the decrypted refresh token, so we only decrypt once. |
| 80 std::string refresh_token_; | 81 std::string refresh_token_; |
| 81 PrefService* local_state_; | 82 PrefService* local_state_; |
| 82 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService); | 83 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService); |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace chromeos | 86 } // namespace chromeos |
| 86 | 87 |
| 87 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ | 88 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ |
| OLD | NEW |