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 #include "chrome/service/cloud_print/cloud_print_auth.h" | 5 #include "chrome/service/cloud_print/cloud_print_auth.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/common/cloud_print/cloud_print_constants.h" | 9 #include "chrome/common/cloud_print/cloud_print_constants.h" |
10 #include "chrome/common/cloud_print/cloud_print_helpers.h" | 10 #include "chrome/common/cloud_print/cloud_print_helpers.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 oauth_client_->GetTokensFromAuthCode(oauth_client_info_, | 100 oauth_client_->GetTokensFromAuthCode(oauth_client_info_, |
101 robot_oauth_auth_code, | 101 robot_oauth_auth_code, |
102 kCloudPrintAuthMaxRetryCount, | 102 kCloudPrintAuthMaxRetryCount, |
103 this); | 103 this); |
104 } | 104 } |
105 | 105 |
106 void CloudPrintAuth::RefreshAccessToken() { | 106 void CloudPrintAuth::RefreshAccessToken() { |
107 oauth_client_.reset(new gaia::GaiaOAuthClient( | 107 oauth_client_.reset(new gaia::GaiaOAuthClient( |
108 GaiaUrls::GetInstance()->oauth2_token_url(), | 108 GaiaUrls::GetInstance()->oauth2_token_url(), |
109 g_service_process->GetServiceURLRequestContextGetter())); | 109 g_service_process->GetServiceURLRequestContextGetter())); |
| 110 std::vector<std::string> empty_scope_list; // (Use scope from refresh token.) |
110 oauth_client_->RefreshToken(oauth_client_info_, | 111 oauth_client_->RefreshToken(oauth_client_info_, |
111 refresh_token_, | 112 refresh_token_, |
| 113 empty_scope_list, |
112 kCloudPrintAuthMaxRetryCount, | 114 kCloudPrintAuthMaxRetryCount, |
113 this); | 115 this); |
114 } | 116 } |
115 | 117 |
116 void CloudPrintAuth::OnGetTokensResponse(const std::string& refresh_token, | 118 void CloudPrintAuth::OnGetTokensResponse(const std::string& refresh_token, |
117 const std::string& access_token, | 119 const std::string& access_token, |
118 int expires_in_seconds) { | 120 int expires_in_seconds) { |
119 refresh_token_ = refresh_token; | 121 refresh_token_ = refresh_token; |
120 // After saving the refresh token, this is just like having just refreshed | 122 // After saving the refresh token, this is just like having just refreshed |
121 // the access token. Just call OnRefreshTokenResponse. | 123 // the access token. Just call OnRefreshTokenResponse. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 DCHECK(!client_login_token_.empty()); | 195 DCHECK(!client_login_token_.empty()); |
194 std::string header; | 196 std::string header; |
195 header = "Authorization: GoogleLogin auth="; | 197 header = "Authorization: GoogleLogin auth="; |
196 header += client_login_token_; | 198 header += client_login_token_; |
197 return header; | 199 return header; |
198 } | 200 } |
199 | 201 |
200 CloudPrintAuth::~CloudPrintAuth() {} | 202 CloudPrintAuth::~CloudPrintAuth() {} |
201 | 203 |
202 } // namespace cloud_print | 204 } // namespace cloud_print |
OLD | NEW |