OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SETUP_OAUTH_CLIENT | 5 #ifndef REMOTING_HOST_SETUP_OAUTH_CLIENT |
6 #define REMOTING_HOST_SETUP_OAUTH_CLIENT | 6 #define REMOTING_HOST_SETUP_OAUTH_CLIENT |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // If a request is received while another one is being processed, it is | 42 // If a request is received while another one is being processed, it is |
43 // enqueued and processed after the first one is finished. | 43 // enqueued and processed after the first one is finished. |
44 void GetCredentialsFromAuthCode( | 44 void GetCredentialsFromAuthCode( |
45 const gaia::OAuthClientInfo& oauth_client_info, | 45 const gaia::OAuthClientInfo& oauth_client_info, |
46 const std::string& auth_code, | 46 const std::string& auth_code, |
47 CompletionCallback on_done); | 47 CompletionCallback on_done); |
48 | 48 |
49 // gaia::GaiaOAuthClient::Delegate | 49 // gaia::GaiaOAuthClient::Delegate |
50 virtual void OnGetTokensResponse(const std::string& refresh_token, | 50 virtual void OnGetTokensResponse(const std::string& refresh_token, |
51 const std::string& access_token, | 51 const std::string& access_token, |
52 int expires_in_seconds) OVERRIDE; | 52 int expires_in_seconds) override; |
53 virtual void OnRefreshTokenResponse(const std::string& access_token, | 53 virtual void OnRefreshTokenResponse(const std::string& access_token, |
54 int expires_in_seconds) OVERRIDE; | 54 int expires_in_seconds) override; |
55 virtual void OnGetUserEmailResponse(const std::string& user_email) OVERRIDE; | 55 virtual void OnGetUserEmailResponse(const std::string& user_email) override; |
56 | 56 |
57 virtual void OnOAuthError() OVERRIDE; | 57 virtual void OnOAuthError() override; |
58 virtual void OnNetworkError(int response_code) OVERRIDE; | 58 virtual void OnNetworkError(int response_code) override; |
59 | 59 |
60 private: | 60 private: |
61 struct Request { | 61 struct Request { |
62 Request(const gaia::OAuthClientInfo& oauth_client_info, | 62 Request(const gaia::OAuthClientInfo& oauth_client_info, |
63 const std::string& auth_code, | 63 const std::string& auth_code, |
64 CompletionCallback on_done); | 64 CompletionCallback on_done); |
65 virtual ~Request(); | 65 virtual ~Request(); |
66 gaia::OAuthClientInfo oauth_client_info; | 66 gaia::OAuthClientInfo oauth_client_info; |
67 std::string auth_code; | 67 std::string auth_code; |
68 CompletionCallback on_done; | 68 CompletionCallback on_done; |
69 }; | 69 }; |
70 | 70 |
71 void SendResponse(const std::string& user_email, | 71 void SendResponse(const std::string& user_email, |
72 const std::string& refresh_token); | 72 const std::string& refresh_token); |
73 | 73 |
74 std::queue<Request> pending_requests_; | 74 std::queue<Request> pending_requests_; |
75 gaia::GaiaOAuthClient gaia_oauth_client_; | 75 gaia::GaiaOAuthClient gaia_oauth_client_; |
76 std::string refresh_token_; | 76 std::string refresh_token_; |
77 CompletionCallback on_done_; | 77 CompletionCallback on_done_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(OAuthClient); | 79 DISALLOW_COPY_AND_ASSIGN(OAuthClient); |
80 }; | 80 }; |
81 | 81 |
82 } // namespace remoting | 82 } // namespace remoting |
83 | 83 |
84 #endif // REMOTING_HOST_SETUP_OAUTH_CLIENT | 84 #endif // REMOTING_HOST_SETUP_OAUTH_CLIENT |
OLD | NEW |