OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 GOOGLE_APIS_GAIA_GAIA_OAUTH_CLIENT_H_ | 5 #ifndef GOOGLE_APIS_GAIA_GAIA_OAUTH_CLIENT_H_ |
6 #define GOOGLE_APIS_GAIA_GAIA_OAUTH_CLIENT_H_ | 6 #define GOOGLE_APIS_GAIA_GAIA_OAUTH_CLIENT_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
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/values.h" | 14 #include "base/values.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 class URLRequestContextGetter; | 17 class URLRequestContextGetter; |
18 } | 18 } |
19 | 19 |
20 // A helper class to get and refresh OAuth2 refresh and access tokens. | 20 // A helper class to get and refresh OAuth2 refresh and access tokens. |
21 // Also exposes utility methods for fetching user email and token information. | 21 // Also exposes utility methods for fetching user email and token information. |
22 // | 22 // |
23 // Supports one request at a time; for parallel requests, create multiple | 23 // Supports one request at a time; for parallel requests, create multiple |
(...skipping 18 matching lines...) Expand all Loading... |
42 int expires_in_seconds) {} | 42 int expires_in_seconds) {} |
43 // Invoked on a successful response to the RefreshToken request. | 43 // Invoked on a successful response to the RefreshToken request. |
44 virtual void OnRefreshTokenResponse(const std::string& access_token, | 44 virtual void OnRefreshTokenResponse(const std::string& access_token, |
45 int expires_in_seconds) {} | 45 int expires_in_seconds) {} |
46 // Invoked on a successful response to the GetUserInfo request. | 46 // Invoked on a successful response to the GetUserInfo request. |
47 virtual void OnGetUserEmailResponse(const std::string& user_email) {} | 47 virtual void OnGetUserEmailResponse(const std::string& user_email) {} |
48 // Invoked on a successful response to the GetUserId request. | 48 // Invoked on a successful response to the GetUserId request. |
49 virtual void OnGetUserIdResponse(const std::string& user_id) {} | 49 virtual void OnGetUserIdResponse(const std::string& user_id) {} |
50 // Invoked on a successful response to the GetUserInfo request. | 50 // Invoked on a successful response to the GetUserInfo request. |
51 virtual void OnGetUserInfoResponse( | 51 virtual void OnGetUserInfoResponse( |
52 scoped_ptr<base::DictionaryValue> user_info) {} | 52 std::unique_ptr<base::DictionaryValue> user_info) {} |
53 // Invoked on a successful response to the GetTokenInfo request. | 53 // Invoked on a successful response to the GetTokenInfo request. |
54 virtual void OnGetTokenInfoResponse( | 54 virtual void OnGetTokenInfoResponse( |
55 scoped_ptr<base::DictionaryValue> token_info) {} | 55 std::unique_ptr<base::DictionaryValue> token_info) {} |
56 // Invoked when there is an OAuth error with one of the requests. | 56 // Invoked when there is an OAuth error with one of the requests. |
57 virtual void OnOAuthError() = 0; | 57 virtual void OnOAuthError() = 0; |
58 // Invoked when there is a network error or upon receiving an invalid | 58 // Invoked when there is a network error or upon receiving an invalid |
59 // response. This is invoked when the maximum number of retries have been | 59 // response. This is invoked when the maximum number of retries have been |
60 // exhausted. If max_retries is -1, this is never invoked. | 60 // exhausted. If max_retries is -1, this is never invoked. |
61 virtual void OnNetworkError(int response_code) = 0; | 61 virtual void OnNetworkError(int response_code) = 0; |
62 | 62 |
63 protected: | 63 protected: |
64 virtual ~Delegate() {} | 64 virtual ~Delegate() {} |
65 }; | 65 }; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 private: | 139 private: |
140 // The guts of the implementation live in this class. | 140 // The guts of the implementation live in this class. |
141 class Core; | 141 class Core; |
142 scoped_refptr<Core> core_; | 142 scoped_refptr<Core> core_; |
143 DISALLOW_COPY_AND_ASSIGN(GaiaOAuthClient); | 143 DISALLOW_COPY_AND_ASSIGN(GaiaOAuthClient); |
144 }; | 144 }; |
145 } | 145 } |
146 | 146 |
147 #endif // GOOGLE_APIS_GAIA_GAIA_OAUTH_CLIENT_H_ | 147 #endif // GOOGLE_APIS_GAIA_GAIA_OAUTH_CLIENT_H_ |
OLD | NEW |