| 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/browser/ui/webui/print_preview/print_preview_handler.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 OAuth2TokenService::ScopeSet oauth_scopes; | 295 OAuth2TokenService::ScopeSet oauth_scopes; |
| 296 oauth_scopes.insert(kCloudPrintAuth); | 296 oauth_scopes.insert(kCloudPrintAuth); |
| 297 scoped_ptr<OAuth2TokenService::Request> request( | 297 scoped_ptr<OAuth2TokenService::Request> request( |
| 298 service->StartRequest(oauth_scopes, this)); | 298 service->StartRequest(oauth_scopes, this)); |
| 299 requests_[type].reset(request.release()); | 299 requests_[type].reset(request.release()); |
| 300 } else { | 300 } else { |
| 301 handler_->SendAccessToken(type, std::string()); // Unknown type. | 301 handler_->SendAccessToken(type, std::string()); // Unknown type. |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 305 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 306 const std::string& access_token, | 306 const std::string& access_token, |
| 307 const base::Time& expiration_time) OVERRIDE { | 307 const base::Time& expiration_time) OVERRIDE { |
| 308 OnServiceResponce(request, access_token); | 308 OnServiceResponce(request, access_token); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 311 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 312 const GoogleServiceAuthError& error) OVERRIDE { | 312 const GoogleServiceAuthError& error) OVERRIDE { |
| 313 OnServiceResponce(request, std::string()); | 313 OnServiceResponce(request, std::string()); |
| 314 } | 314 } |
| 315 | 315 |
| 316 private: | 316 private: |
| 317 void OnServiceResponce(const OAuth2TokenService::Request* request, | 317 void OnServiceResponce(const OAuth2TokenService::Request* request, |
| 318 const std::string& access_token) { | 318 const std::string& access_token) { |
| 319 for (Requests::iterator i = requests_.begin(); i != requests_.end(); ++i) { | 319 for (Requests::iterator i = requests_.begin(); i != requests_.end(); ++i) { |
| 320 if (i->second == request) { | 320 if (i->second == request) { |
| 321 handler_->SendAccessToken(i->first, access_token); | 321 handler_->SendAccessToken(i->first, access_token); |
| 322 requests_.erase(i); | 322 requests_.erase(i); |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 // Nothing to print, no preview available. | 1084 // Nothing to print, no preview available. |
| 1085 return false; | 1085 return false; |
| 1086 } | 1086 } |
| 1087 DCHECK(tmp_data->size() && tmp_data->front()); | 1087 DCHECK(tmp_data->size() && tmp_data->front()); |
| 1088 | 1088 |
| 1089 *data = tmp_data; | 1089 *data = tmp_data; |
| 1090 *title = print_preview_ui->initiator_tab_title(); | 1090 *title = print_preview_ui->initiator_tab_title(); |
| 1091 return true; | 1091 return true; |
| 1092 } | 1092 } |
| 1093 | 1093 |
| OLD | NEW |