Chromium Code Reviews| Index: chrome/browser/chromeos/settings/device_oauth2_token_service.h |
| diff --git a/chrome/browser/chromeos/settings/device_oauth2_token_service.h b/chrome/browser/chromeos/settings/device_oauth2_token_service.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..28b14d671bba78ec9b687058e81d81018b9f5846 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/settings/device_oauth2_token_service.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ |
| +#define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/signin/oauth2_token_service.h" |
| +#include "net/url_request/url_request_context_getter.h" |
| + |
| +namespace net { |
| +class URLRequestContextGetter; |
| +} |
| + |
| +class GoogleServiceAuthError; |
| +class PrefRegistrySimple; |
| +class Profile; |
| + |
| +namespace chromeos { |
| + |
| +// DeviceOAuth2TokenService retrieves OAuth2 access tokens for a given |
| +// set of scopes using the device-level OAuth2 any-api refresh token |
| +// obtained during enterprise device enrollment. |
| +// |
| +// See |OAuth2TokenService| for usage details. |
| +// |
| +// Note that requests must be made from the UI thread. |
| +class DeviceOAuth2TokenService : public OAuth2TokenService { |
| + public: |
| + virtual ~DeviceOAuth2TokenService(); |
|
Andrew T Wilson (Slow)
2013/03/19 19:58:44
Hrm. constructor is private, but destructor is pub
David Roche
2013/03/21 00:12:02
Added comment that it's public due to use of scope
|
| + |
| + // Persist the given refresh token on the device. Overwrites any previous |
| + // value. Should only be called during initial device setup. |
| + void SaveRefreshToken(const std::string& refresh_token); |
|
Andrew T Wilson (Slow)
2013/03/19 19:58:44
This is fine as-is, but consider making this "SetR
David Roche
2013/03/21 00:12:02
Done.
|
| + |
| + static void RegisterPrefs(PrefRegistrySimple* registry); |
| + |
| + protected: |
| + virtual std::string GetRefreshToken() OVERRIDE; |
| + |
| + private: |
| + explicit DeviceOAuth2TokenService(net::URLRequestContextGetter* getter); |
| + friend class DeviceOAuth2TokenServiceFactory; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ |