| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // | 32 // |
| 33 // Note that requests must be made from the UI thread. | 33 // Note that requests must be made from the UI thread. |
| 34 class DeviceOAuth2TokenService : public OAuth2TokenService { | 34 class DeviceOAuth2TokenService : public OAuth2TokenService { |
| 35 public: | 35 public: |
| 36 // Persist the given refresh token on the device. Overwrites any previous | 36 // Persist the given refresh token on the device. Overwrites any previous |
| 37 // value. Should only be called during initial device setup. | 37 // value. Should only be called during initial device setup. |
| 38 void SetAndSaveRefreshToken(const std::string& refresh_token); | 38 void SetAndSaveRefreshToken(const std::string& refresh_token); |
| 39 | 39 |
| 40 static void RegisterPrefs(PrefRegistrySimple* registry); | 40 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 41 | 41 |
| 42 protected: | |
| 43 virtual std::string GetRefreshToken() OVERRIDE; | 42 virtual std::string GetRefreshToken() OVERRIDE; |
| 44 | 43 |
| 45 private: | 44 private: |
| 46 friend class DeviceOAuth2TokenServiceFactory; | 45 friend class DeviceOAuth2TokenServiceFactory; |
| 47 FRIEND_TEST_ALL_PREFIXES(DeviceOAuth2TokenServiceTest, SaveEncryptedToken); | 46 FRIEND_TEST_ALL_PREFIXES(DeviceOAuth2TokenServiceTest, SaveEncryptedToken); |
| 48 | 47 |
| 49 // Use DeviceOAuth2TokenServiceFactory to get an instance of this class. | 48 // Use DeviceOAuth2TokenServiceFactory to get an instance of this class. |
| 50 explicit DeviceOAuth2TokenService(net::URLRequestContextGetter* getter, | 49 explicit DeviceOAuth2TokenService(net::URLRequestContextGetter* getter, |
| 51 PrefService* local_state); | 50 PrefService* local_state); |
| 52 virtual ~DeviceOAuth2TokenService(); | 51 virtual ~DeviceOAuth2TokenService(); |
| 53 | 52 |
| 54 // Cache the decrypted refresh token, so we only decrypt once. | 53 // Cache the decrypted refresh token, so we only decrypt once. |
| 55 std::string refresh_token_; | 54 std::string refresh_token_; |
| 56 PrefService* local_state_; | 55 PrefService* local_state_; |
| 57 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService); | 56 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService); |
| 58 }; | 57 }; |
| 59 | 58 |
| 60 } // namespace chromeos | 59 } // namespace chromeos |
| 61 | 60 |
| 62 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ | 61 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ |
| OLD | NEW |