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 REMOTING_HOST_OAUTH_TOKEN_GETTER_H_ | 5 #ifndef REMOTING_HOST_OAUTH_TOKEN_GETTER_H_ |
6 #define REMOTING_HOST_OAUTH_TOKEN_GETTER_H_ | 6 #define REMOTING_HOST_OAUTH_TOKEN_GETTER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, | 61 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, |
62 bool auto_refresh); | 62 bool auto_refresh); |
63 virtual ~OAuthTokenGetter(); | 63 virtual ~OAuthTokenGetter(); |
64 | 64 |
65 // Call |on_access_token| with an access token, or the failure status. | 65 // Call |on_access_token| with an access token, or the failure status. |
66 void CallWithToken(const OAuthTokenGetter::TokenCallback& on_access_token); | 66 void CallWithToken(const OAuthTokenGetter::TokenCallback& on_access_token); |
67 | 67 |
68 // gaia::GaiaOAuthClient::Delegate interface. | 68 // gaia::GaiaOAuthClient::Delegate interface. |
69 virtual void OnGetTokensResponse(const std::string& user_email, | 69 virtual void OnGetTokensResponse(const std::string& user_email, |
70 const std::string& access_token, | 70 const std::string& access_token, |
71 int expires_seconds) OVERRIDE; | 71 int expires_seconds) override; |
72 virtual void OnRefreshTokenResponse(const std::string& access_token, | 72 virtual void OnRefreshTokenResponse(const std::string& access_token, |
73 int expires_in_seconds) OVERRIDE; | 73 int expires_in_seconds) override; |
74 virtual void OnGetUserEmailResponse(const std::string& user_email) OVERRIDE; | 74 virtual void OnGetUserEmailResponse(const std::string& user_email) override; |
75 virtual void OnOAuthError() OVERRIDE; | 75 virtual void OnOAuthError() override; |
76 virtual void OnNetworkError(int response_code) OVERRIDE; | 76 virtual void OnNetworkError(int response_code) override; |
77 | 77 |
78 private: | 78 private: |
79 void NotifyCallbacks(Status status, | 79 void NotifyCallbacks(Status status, |
80 const std::string& user_email, | 80 const std::string& user_email, |
81 const std::string& access_token); | 81 const std::string& access_token); |
82 void RefreshOAuthToken(); | 82 void RefreshOAuthToken(); |
83 | 83 |
84 scoped_ptr<OAuthCredentials> oauth_credentials_; | 84 scoped_ptr<OAuthCredentials> oauth_credentials_; |
85 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 85 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
86 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 86 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
87 | 87 |
88 bool refreshing_oauth_token_; | 88 bool refreshing_oauth_token_; |
89 std::string oauth_access_token_; | 89 std::string oauth_access_token_; |
90 std::string verified_email_; | 90 std::string verified_email_; |
91 base::Time auth_token_expiry_time_; | 91 base::Time auth_token_expiry_time_; |
92 std::queue<OAuthTokenGetter::TokenCallback> pending_callbacks_; | 92 std::queue<OAuthTokenGetter::TokenCallback> pending_callbacks_; |
93 scoped_ptr<base::OneShotTimer<OAuthTokenGetter> > refresh_timer_; | 93 scoped_ptr<base::OneShotTimer<OAuthTokenGetter> > refresh_timer_; |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(OAuthTokenGetter); | 95 DISALLOW_COPY_AND_ASSIGN(OAuthTokenGetter); |
96 }; | 96 }; |
97 | 97 |
98 } // namespace remoting | 98 } // namespace remoting |
99 | 99 |
100 #endif // REMOTING_HOST_OAUTH_TOKEN_GETTER_H_ | 100 #endif // REMOTING_HOST_OAUTH_TOKEN_GETTER_H_ |
OLD | NEW |