Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: chrome/service/cloud_print/cloud_print_proxy_backend.cc

Issue 6523040: Added support to the Windows cloud print proxy to print XPS documents directl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Code review changes Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/service/cloud_print/cloud_print_url_fetcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_proxy_backend.h" 5 #include "chrome/service/cloud_print/cloud_print_proxy_backend.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 } 468 }
469 469
470 void CloudPrintProxyBackend::Core::GetRegisteredPrinters() { 470 void CloudPrintProxyBackend::Core::GetRegisteredPrinters() {
471 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); 471 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop());
472 GURL printer_list_url = 472 GURL printer_list_url =
473 CloudPrintHelpers::GetUrlForPrinterList(cloud_print_server_url_, 473 CloudPrintHelpers::GetUrlForPrinterList(cloud_print_server_url_,
474 proxy_id_); 474 proxy_id_);
475 next_response_handler_ = 475 next_response_handler_ =
476 &CloudPrintProxyBackend::Core::HandlePrinterListResponse; 476 &CloudPrintProxyBackend::Core::HandlePrinterListResponse;
477 request_ = new CloudPrintURLFetcher; 477 request_ = new CloudPrintURLFetcher;
478 request_->StartGetRequest(printer_list_url, this, auth_token_, 478 request_->StartGetRequest(printer_list_url,
479 kCloudPrintAPIMaxRetryCount); 479 this,
480 auth_token_,
481 kCloudPrintAPIMaxRetryCount,
482 std::string());
480 } 483 }
481 484
482 void CloudPrintProxyBackend::Core::RegisterNextPrinter() { 485 void CloudPrintProxyBackend::Core::RegisterNextPrinter() {
483 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); 486 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop());
484 // For the next printer to be uploaded, create a multi-part post request to 487 // For the next printer to be uploaded, create a multi-part post request to
485 // upload the printer capabilities and the printer defaults. 488 // upload the printer capabilities and the printer defaults.
486 if (next_upload_index_ < printer_list_.size()) { 489 if (next_upload_index_ < printer_list_.size()) {
487 const printing::PrinterBasicInfo& info = 490 const printing::PrinterBasicInfo& info =
488 printer_list_.at(next_upload_index_); 491 printer_list_.at(next_upload_index_);
489 // If we are retrying a previous upload, we don't need to fetch the caps 492 // If we are retrying a previous upload, we don't need to fetch the caps
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 GURL post_url = CloudPrintHelpers::GetUrlForPrinterRegistration( 561 GURL post_url = CloudPrintHelpers::GetUrlForPrinterRegistration(
559 cloud_print_server_url_); 562 cloud_print_server_url_);
560 563
561 next_response_handler_ = 564 next_response_handler_ =
562 &CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse; 565 &CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse;
563 // Terminate the request body 566 // Terminate the request body
564 post_data.append("--" + mime_boundary + "--\r\n"); 567 post_data.append("--" + mime_boundary + "--\r\n");
565 std::string mime_type("multipart/form-data; boundary="); 568 std::string mime_type("multipart/form-data; boundary=");
566 mime_type += mime_boundary; 569 mime_type += mime_boundary;
567 request_ = new CloudPrintURLFetcher; 570 request_ = new CloudPrintURLFetcher;
568 request_->StartPostRequest(post_url, this, auth_token_, 571 request_->StartPostRequest(post_url,
569 kCloudPrintAPIMaxRetryCount, mime_type, 572 this,
570 post_data); 573 auth_token_,
574 kCloudPrintAPIMaxRetryCount,
575 mime_type,
576 post_data,
577 std::string());
571 } else { 578 } else {
572 LOG(ERROR) << "CP_PROXY: Failed to get printer info for: " << 579 LOG(ERROR) << "CP_PROXY: Failed to get printer info for: " <<
573 printer_name; 580 printer_name;
574 // This printer failed to register, notify the server of this failure. 581 // This printer failed to register, notify the server of this failure.
575 string16 printer_name_utf16 = UTF8ToUTF16(printer_name); 582 string16 printer_name_utf16 = UTF8ToUTF16(printer_name);
576 std::string status_message = l10n_util::GetStringFUTF8( 583 std::string status_message = l10n_util::GetStringFUTF8(
577 IDS_CLOUD_PRINT_REGISTER_PRINTER_FAILED, 584 IDS_CLOUD_PRINT_REGISTER_PRINTER_FAILED,
578 printer_name_utf16); 585 printer_name_utf16);
579 ReportUserMessage( 586 ReportUserMessage(
580 kGetPrinterCapsFailedMessageId, 587 kGetPrinterCapsFailedMessageId,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 failure_message, 774 failure_message,
768 mime_boundary, 775 mime_boundary,
769 std::string(), 776 std::string(),
770 &post_data); 777 &post_data);
771 next_response_handler_ = handler; 778 next_response_handler_ = handler;
772 // Terminate the request body 779 // Terminate the request body
773 post_data.append("--" + mime_boundary + "--\r\n"); 780 post_data.append("--" + mime_boundary + "--\r\n");
774 std::string mime_type("multipart/form-data; boundary="); 781 std::string mime_type("multipart/form-data; boundary=");
775 mime_type += mime_boundary; 782 mime_type += mime_boundary;
776 request_ = new CloudPrintURLFetcher; 783 request_ = new CloudPrintURLFetcher;
777 request_->StartPostRequest(post_url, this, auth_token_, 784 request_->StartPostRequest(post_url,
778 kCloudPrintAPIMaxRetryCount, mime_type, 785 this,
779 post_data); 786 auth_token_,
787 kCloudPrintAPIMaxRetryCount,
788 mime_type,
789 post_data,
790 std::string());
780 } 791 }
781 792
782 CloudPrintURLFetcher::ResponseAction 793 CloudPrintURLFetcher::ResponseAction
783 CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse( 794 CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse(
784 const URLFetcher* source, 795 const URLFetcher* source,
785 const GURL& url, 796 const GURL& url,
786 DictionaryValue* json_data, 797 DictionaryValue* json_data,
787 bool succeeded) { 798 bool succeeded) {
788 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); 799 DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop());
789 if (succeeded) { 800 if (succeeded) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 &Core::NotifyAuthenticationFailed)); 936 &Core::NotifyAuthenticationFailed));
926 } 937 }
927 938
928 void CloudPrintProxyBackend::Core::OnPrinterNotFound( 939 void CloudPrintProxyBackend::Core::OnPrinterNotFound(
929 const std::string& printer_name, 940 const std::string& printer_name,
930 bool* delete_from_server) { 941 bool* delete_from_server) {
931 // If we have a complete list of local printers, then this needs to be deleted 942 // If we have a complete list of local printers, then this needs to be deleted
932 // from the server. 943 // from the server.
933 *delete_from_server = complete_list_available_; 944 *delete_from_server = complete_list_available_;
934 } 945 }
OLDNEW
« no previous file with comments | « no previous file | chrome/service/cloud_print/cloud_print_url_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698