| 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 CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ | 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ |
| 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ | 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // actually perform synchronous (and potentially blocking) operations. | 49 // actually perform synchronous (and potentially blocking) operations. |
| 50 void AuthenticateWithToken(const std::string& cloud_print_token); | 50 void AuthenticateWithToken(const std::string& cloud_print_token); |
| 51 void AuthenticateWithRobotToken(const std::string& robot_oauth_refresh_token, | 51 void AuthenticateWithRobotToken(const std::string& robot_oauth_refresh_token, |
| 52 const std::string& robot_email); | 52 const std::string& robot_email); |
| 53 void AuthenticateWithRobotAuthCode(const std::string& robot_oauth_auth_code, | 53 void AuthenticateWithRobotAuthCode(const std::string& robot_oauth_auth_code, |
| 54 const std::string& robot_email); | 54 const std::string& robot_email); |
| 55 | 55 |
| 56 void RefreshAccessToken(); | 56 void RefreshAccessToken(); |
| 57 | 57 |
| 58 // gaia::GaiaOAuthClient::Delegate implementation. | 58 // gaia::GaiaOAuthClient::Delegate implementation. |
| 59 virtual void OnGetTokensResponse(const std::string& refresh_token, | 59 void OnGetTokensResponse(const std::string& refresh_token, |
| 60 const std::string& access_token, | 60 const std::string& access_token, |
| 61 int expires_in_seconds) override; | 61 int expires_in_seconds) override; |
| 62 virtual void OnRefreshTokenResponse(const std::string& access_token, | 62 void OnRefreshTokenResponse(const std::string& access_token, |
| 63 int expires_in_seconds) override; | 63 int expires_in_seconds) override; |
| 64 virtual void OnOAuthError() override; | 64 void OnOAuthError() override; |
| 65 virtual void OnNetworkError(int response_code) override; | 65 void OnNetworkError(int response_code) override; |
| 66 | 66 |
| 67 // CloudPrintURLFetcher::Delegate implementation. | 67 // CloudPrintURLFetcher::Delegate implementation. |
| 68 virtual CloudPrintURLFetcher::ResponseAction HandleJSONData( | 68 CloudPrintURLFetcher::ResponseAction HandleJSONData( |
| 69 const net::URLFetcher* source, | 69 const net::URLFetcher* source, |
| 70 const GURL& url, | 70 const GURL& url, |
| 71 base::DictionaryValue* json_data, | 71 base::DictionaryValue* json_data, |
| 72 bool succeeded) override; | 72 bool succeeded) override; |
| 73 virtual CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override; | 73 CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override; |
| 74 virtual std::string GetAuthHeader() override; | 74 std::string GetAuthHeader() override; |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 friend class base::RefCountedThreadSafe<CloudPrintAuth>; | 77 friend class base::RefCountedThreadSafe<CloudPrintAuth>; |
| 78 virtual ~CloudPrintAuth(); | 78 ~CloudPrintAuth() override; |
| 79 | 79 |
| 80 Client* client_; | 80 Client* client_; |
| 81 gaia::OAuthClientInfo oauth_client_info_; | 81 gaia::OAuthClientInfo oauth_client_info_; |
| 82 scoped_ptr<gaia::GaiaOAuthClient> oauth_client_; | 82 scoped_ptr<gaia::GaiaOAuthClient> oauth_client_; |
| 83 | 83 |
| 84 // The CloudPrintURLFetcher instance for the current request. | 84 // The CloudPrintURLFetcher instance for the current request. |
| 85 scoped_refptr<CloudPrintURLFetcher> request_; | 85 scoped_refptr<CloudPrintURLFetcher> request_; |
| 86 | 86 |
| 87 GURL cloud_print_server_url_; | 87 GURL cloud_print_server_url_; |
| 88 // Proxy id, need to send to the cloud print server to find and update | 88 // Proxy id, need to send to the cloud print server to find and update |
| (...skipping 11 matching lines...) Expand all Loading... |
| 100 // get the robot account. | 100 // get the robot account. |
| 101 std::string client_login_token_; | 101 std::string client_login_token_; |
| 102 | 102 |
| 103 DISALLOW_COPY_AND_ASSIGN(CloudPrintAuth); | 103 DISALLOW_COPY_AND_ASSIGN(CloudPrintAuth); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } // namespace cloud_print | 106 } // namespace cloud_print |
| 107 | 107 |
| 108 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ | 108 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ |
| 109 | 109 |
| OLD | NEW |