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 REMOTING_HOST_GAIA_OAUTH_CLIENT_H_ | 5 #ifndef REMOTING_HOST_GAIA_OAUTH_CLIENT_H_ |
6 #define REMOTING_HOST_GAIA_OAUTH_CLIENT_H_ | 6 #define REMOTING_HOST_GAIA_OAUTH_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 19 matching lines...) Expand all Loading... | |
30 std::string client_secret; | 30 std::string client_secret; |
31 }; | 31 }; |
32 | 32 |
33 class GaiaOAuthClient { | 33 class GaiaOAuthClient { |
34 public: | 34 public: |
35 class Delegate { | 35 class Delegate { |
36 public: | 36 public: |
37 virtual ~Delegate() { } | 37 virtual ~Delegate() { } |
38 | 38 |
39 // Invoked on a successful response to the RefreshToken request. | 39 // Invoked on a successful response to the RefreshToken request. |
40 virtual void OnRefreshTokenResponse(const std::string& access_token, | 40 virtual void OnRefreshTokenResponse(const std::string& email, |
Wez
2012/05/16 23:00:07
nit: email -> user_email?
Sergey Ulanov
2012/05/17 00:38:11
Done.
| |
41 const std::string& access_token, | |
41 int expires_in_seconds) = 0; | 42 int expires_in_seconds) = 0; |
42 // Invoked when there is an OAuth error with one of the requests. | 43 // Invoked when there is an OAuth error with one of the requests. |
43 virtual void OnOAuthError() = 0; | 44 virtual void OnOAuthError() = 0; |
44 // Invoked when there is a network error or upon receiving an | 45 // Invoked when there is a network error or upon receiving an |
45 // invalid response. | 46 // invalid response. |
46 virtual void OnNetworkError(int response_code) = 0; | 47 virtual void OnNetworkError(int response_code) = 0; |
47 }; | 48 }; |
48 GaiaOAuthClient(const std::string& gaia_url, | 49 GaiaOAuthClient(const std::string& gaia_url, |
49 net::URLRequestContextGetter* context_getter); | 50 net::URLRequestContextGetter* context_getter); |
50 ~GaiaOAuthClient(); | 51 ~GaiaOAuthClient(); |
51 | 52 |
52 void RefreshToken(const OAuthClientInfo& oauth_client_info, | 53 void RefreshToken(const OAuthClientInfo& oauth_client_info, |
53 const std::string& refresh_token, | 54 const std::string& refresh_token, |
54 Delegate* delegate); | 55 Delegate* delegate); |
55 | 56 |
56 private: | 57 private: |
57 // The guts of the implementation live in this class. | 58 // The guts of the implementation live in this class. |
58 class Core; | 59 class Core; |
59 scoped_refptr<Core> core_; | 60 scoped_refptr<Core> core_; |
60 DISALLOW_COPY_AND_ASSIGN(GaiaOAuthClient); | 61 DISALLOW_COPY_AND_ASSIGN(GaiaOAuthClient); |
61 }; | 62 }; |
62 | 63 |
63 } // namespace remoting | 64 } // namespace remoting |
64 | 65 |
65 #endif // CHROME_COMMON_NET_GAIA_GAIA_OAUTH_CLIENT_H_ | 66 #endif // CHROME_COMMON_NET_GAIA_GAIA_OAUTH_CLIENT_H_ |
OLD | NEW |