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

Side by Side Diff: chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fetcher.h

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REFRESH_TOKEN_FETC HER_H_ 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REFRESH_TOKEN_FETC HER_H_
6 #define CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REFRESH_TOKEN_FETC HER_H_ 6 #define CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REFRESH_TOKEN_FETC HER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 14
15 class GoogleServiceAuthError; 15 class GoogleServiceAuthError;
16 class OAuth2TokenService; 16 class OAuth2TokenService;
17 17
18 namespace user_manager {
19 class UserID;
20 }
21
18 namespace net { 22 namespace net {
19 class URLRequestContextGetter; 23 class URLRequestContextGetter;
20 } 24 }
21 25
22 // This class fetches an OAuth2 refresh token that is tied to a supervised user 26 // This class fetches an OAuth2 refresh token that is tied to a supervised user
23 // ID and downscoped to a special scope for Chrome Sync for supervised users. 27 // ID and downscoped to a special scope for Chrome Sync for supervised users.
24 // Fetching the token consists of the following steps: 28 // Fetching the token consists of the following steps:
25 // 1. Get an access token for the custodian from OAuth2TokenService 29 // 1. Get an access token for the custodian from OAuth2TokenService
26 // (either cached or fetched). 30 // (either cached or fetched).
27 // 2. Call the IssueToken API to mint a scoped authorization code for a 31 // 2. Call the IssueToken API to mint a scoped authorization code for a
28 // refresh token for the supervised user from the custodian's access token. 32 // refresh token for the supervised user from the custodian's access token.
29 // 3. Exchange the authorization code for a refresh token for the supervised 33 // 3. Exchange the authorization code for a refresh token for the supervised
30 // user and return it to the caller. The refresh token can only be used to 34 // user and return it to the caller. The refresh token can only be used to
31 // mint tokens with the special supervised user Sync scope. 35 // mint tokens with the special supervised user Sync scope.
32 class SupervisedUserRefreshTokenFetcher { 36 class SupervisedUserRefreshTokenFetcher {
33 public: 37 public:
34 typedef base::Callback<void(const GoogleServiceAuthError& /* error */, 38 typedef base::Callback<void(const GoogleServiceAuthError& /* error */,
35 const std::string& /* refresh_token */)> 39 const std::string& /* refresh_token */)>
36 TokenCallback; 40 TokenCallback;
37 41
38 static scoped_ptr<SupervisedUserRefreshTokenFetcher> Create( 42 static scoped_ptr<SupervisedUserRefreshTokenFetcher> Create(
39 OAuth2TokenService* oauth2_token_service, 43 OAuth2TokenService* oauth2_token_service,
40 const std::string& account_id, 44 const std::string& account_id,
41 const std::string& device_id, 45 const std::string& device_id,
42 net::URLRequestContextGetter* context); 46 net::URLRequestContextGetter* context);
43 47
44 virtual ~SupervisedUserRefreshTokenFetcher(); 48 virtual ~SupervisedUserRefreshTokenFetcher();
45 49
46 virtual void Start(const std::string& supervised_user_id, 50 virtual void Start(const user_manager::UserID& supervised_user_id,
47 const std::string& device_name, 51 const std::string& device_name,
48 const TokenCallback& callback) = 0; 52 const TokenCallback& callback) = 0;
49 }; 53 };
50 54
51 #endif // CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REFRESH_TOKEN_F ETCHER_H_ 55 #endif // CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REFRESH_TOKEN_F ETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698