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

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

Issue 12647008: Refactor OAuth2TokenService to have profile- and device-based implementations. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed final review comments Created 7 years, 9 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/signin/oauth2_token_service.h"
13 #include "net/url_request/url_request_context_getter.h"
14
15 namespace net {
16 class URLRequestContextGetter;
17 }
18
19 class GoogleServiceAuthError;
20 class PrefRegistrySimple;
21 class PrefService;
22 class Profile;
brettw 2013/03/28 20:18:32 Your CL description and this code references Profi
23
24 namespace chromeos {
25
26 // DeviceOAuth2TokenService retrieves OAuth2 access tokens for a given
27 // set of scopes using the device-level OAuth2 any-api refresh token
28 // obtained during enterprise device enrollment. The instance for the
29 // current browser is available from
30 // g_browser_process->device_oauth2_token_service().
31 //
32 // See |OAuth2TokenService| for usage details.
33 //
34 // Note that requests must be made from the UI thread.
35 class DeviceOAuth2TokenService : public OAuth2TokenService {
36 public:
37 // Do not call the constructor, instead use the instance from
38 // g_browser_process->device_oauth2_token_service().
39 explicit DeviceOAuth2TokenService(net::URLRequestContextGetter* getter,
40 PrefService* local_state);
41 virtual ~DeviceOAuth2TokenService();
42
43 // Persist the given refresh token on the device. Overwrites any previous
44 // value. Should only be called during initial device setup.
45 void SetAndSaveRefreshToken(const std::string& refresh_token);
46
47 static void RegisterPrefs(PrefRegistrySimple* registry);
48
49 protected:
50 virtual std::string GetRefreshToken() OVERRIDE;
51
52 private:
53 PrefService* local_state_;
54 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService);
55 };
56
57 } // namespace chromeos
58
59 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698