OLD | NEW |
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 GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ | 5 #ifndef GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ |
6 #define GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ | 6 #define GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <set> | 9 #include <set> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
16 #include "google_apis/gaia/oauth2_token_service.h" | 16 #include "google_apis/gaia/oauth2_token_service.h" |
17 | 17 |
18 // OAuth2TokenServiceRequest represents an asynchronous request to an | 18 // OAuth2TokenServiceRequest represents an asynchronous request to an |
19 // OAuth2TokenService that may live in another thread. | 19 // OAuth2TokenService that may live in another thread. |
20 // | 20 // |
21 // An OAuth2TokenServiceRequest can be created and started from any thread. | 21 // An OAuth2TokenServiceRequest can be created and started from any thread. |
22 class OAuth2TokenServiceRequest : public OAuth2TokenService::Request, | 22 class OAuth2TokenServiceRequest : public OAuth2TokenService::Request, |
23 public base::NonThreadSafe { | 23 public base::NonThreadSafe { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // | 62 // |
63 // |account_id| must not be empty. | 63 // |account_id| must not be empty. |
64 // | 64 // |
65 // |scopes| must not be empty. | 65 // |scopes| must not be empty. |
66 // | 66 // |
67 // |consumer| will be invoked in the same thread that invoked CreateAndStart | 67 // |consumer| will be invoked in the same thread that invoked CreateAndStart |
68 // and must outlive the returned request object. Destroying the request | 68 // and must outlive the returned request object. Destroying the request |
69 // object ensure that |consumer| will not be called. However, the actual | 69 // object ensure that |consumer| will not be called. However, the actual |
70 // network activities may not be canceled and the cache in OAuth2TokenService | 70 // network activities may not be canceled and the cache in OAuth2TokenService |
71 // may be populated with the fetched results. | 71 // may be populated with the fetched results. |
72 static scoped_ptr<OAuth2TokenServiceRequest> CreateAndStart( | 72 static std::unique_ptr<OAuth2TokenServiceRequest> CreateAndStart( |
73 const scoped_refptr<TokenServiceProvider>& provider, | 73 const scoped_refptr<TokenServiceProvider>& provider, |
74 const std::string& account_id, | 74 const std::string& account_id, |
75 const OAuth2TokenService::ScopeSet& scopes, | 75 const OAuth2TokenService::ScopeSet& scopes, |
76 OAuth2TokenService::Consumer* consumer); | 76 OAuth2TokenService::Consumer* consumer); |
77 | 77 |
78 // Invalidates |access_token| for |account_id| and |scopes|. | 78 // Invalidates |access_token| for |account_id| and |scopes|. |
79 // | 79 // |
80 // |provider| is used to get the OAuth2TokenService. | 80 // |provider| is used to get the OAuth2TokenService. |
81 // | 81 // |
82 // |account_id| must not be empty. | 82 // |account_id| must not be empty. |
(...skipping 15 matching lines...) Expand all Loading... |
98 | 98 |
99 void StartWithCore(const scoped_refptr<Core>& core); | 99 void StartWithCore(const scoped_refptr<Core>& core); |
100 | 100 |
101 const std::string account_id_; | 101 const std::string account_id_; |
102 scoped_refptr<Core> core_; | 102 scoped_refptr<Core> core_; |
103 | 103 |
104 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenServiceRequest); | 104 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenServiceRequest); |
105 }; | 105 }; |
106 | 106 |
107 #endif // GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ | 107 #endif // GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ |
OLD | NEW |