OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_REQUEST_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_REQUEST_H_ |
6 #define CHROME_BROWSER_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_REQUEST_H_ | 6 #define CHROME_BROWSER_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_REQUEST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
12 #include "google_apis/gaia/oauth2_token_service.h" | 12 #include "google_apis/gaia/oauth2_token_service.h" |
13 | 13 |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 // ProfileOAuth2TokenServiceRequest represents a request to fetch an | 16 // ProfileOAuth2TokenServiceRequest represents a request to fetch an |
17 // OAuth2 access token for a given set of |scopes| by calling |profile|'s | 17 // OAuth2 access token for a given set of |scopes| by calling |profile|'s |
18 // ProfileOAuth2TokenService. A request can be created and started from | 18 // ProfileOAuth2TokenService. A request can be created and started from |
19 // any thread with an object |consumer| that will be called back on the | 19 // any thread with an object |consumer| that will be called back on the |
20 // same thread when fetching completes. If the request is destructed | 20 // same thread when fetching completes. If the request is destructed |
21 // before |consumer| is called, |consumer| will never be called back. (Note | 21 // before |consumer| is called, |consumer| will never be called back. (Note |
22 // the actual network activities are not canceled and the cache in | 22 // the actual network activities are not canceled and the cache in |
23 // ProfileOAuth2TokenService will be populated with the fetched results.) | 23 // ProfileOAuth2TokenService will be populated with the fetched results.) |
24 class ProfileOAuth2TokenServiceRequest : public OAuth2TokenService::Request, | 24 class ProfileOAuth2TokenServiceRequest : public OAuth2TokenService::Request, |
25 public base::NonThreadSafe { | 25 public base::NonThreadSafe { |
26 public: | 26 public: |
27 static ProfileOAuth2TokenServiceRequest* CreateAndStart( | 27 static ProfileOAuth2TokenServiceRequest* CreateAndStart( |
28 Profile* profile, | 28 Profile* profile, |
| 29 const std::string& account_id, |
29 const OAuth2TokenService::ScopeSet& scopes, | 30 const OAuth2TokenService::ScopeSet& scopes, |
30 OAuth2TokenService::Consumer* consumer); | 31 OAuth2TokenService::Consumer* consumer); |
31 | 32 |
32 virtual ~ProfileOAuth2TokenServiceRequest(); | 33 virtual ~ProfileOAuth2TokenServiceRequest(); |
33 | 34 |
34 private: | 35 private: |
35 class Core; | 36 class Core; |
36 friend class Core; | 37 friend class Core; |
37 | 38 |
38 ProfileOAuth2TokenServiceRequest(Profile* profile, | 39 ProfileOAuth2TokenServiceRequest(Profile* profile, |
| 40 const std::string& account_id, |
39 const OAuth2TokenService::ScopeSet& scopes, | 41 const OAuth2TokenService::ScopeSet& scopes, |
40 OAuth2TokenService::Consumer* consumer); | 42 OAuth2TokenService::Consumer* consumer); |
41 OAuth2TokenService::Consumer* const consumer_; | 43 OAuth2TokenService::Consumer* const consumer_; |
42 scoped_refptr<Core> core_; | 44 scoped_refptr<Core> core_; |
43 | 45 |
44 DISALLOW_COPY_AND_ASSIGN(ProfileOAuth2TokenServiceRequest); | 46 DISALLOW_COPY_AND_ASSIGN(ProfileOAuth2TokenServiceRequest); |
45 }; | 47 }; |
46 | 48 |
47 #endif // CHROME_BROWSER_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_REQUEST_H_ | 49 #endif // CHROME_BROWSER_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_REQUEST_H_ |
OLD | NEW |