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

Side by Side Diff: trunk/src/chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 101113004: Revert 239759 "The comment in base64.h implies that base::Base64..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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
OLDNEW
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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 base::StringValue gcp_url_value(gcp_url.spec()); 1165 base::StringValue gcp_url_value(gcp_url.spec());
1166 web_ui()->CallJavascriptFunction("setUseCloudPrint", gcp_url_value); 1166 web_ui()->CallJavascriptFunction("setUseCloudPrint", gcp_url_value);
1167 } 1167 }
1168 } 1168 }
1169 1169
1170 void PrintPreviewHandler::SendCloudPrintJob(const base::RefCountedBytes* data) { 1170 void PrintPreviewHandler::SendCloudPrintJob(const base::RefCountedBytes* data) {
1171 // BASE64 encode the job data. 1171 // BASE64 encode the job data.
1172 std::string raw_data(reinterpret_cast<const char*>(data->front()), 1172 std::string raw_data(reinterpret_cast<const char*>(data->front()),
1173 data->size()); 1173 data->size());
1174 std::string base64_data; 1174 std::string base64_data;
1175 base::Base64Encode(raw_data, &base64_data); 1175 if (!base::Base64Encode(raw_data, &base64_data)) {
1176 NOTREACHED() << "Base64 encoding PDF data.";
1177 }
1176 StringValue data_value(base64_data); 1178 StringValue data_value(base64_data);
1177 1179
1178 web_ui()->CallJavascriptFunction("printToCloud", data_value); 1180 web_ui()->CallJavascriptFunction("printToCloud", data_value);
1179 } 1181 }
1180 1182
1181 WebContents* PrintPreviewHandler::GetInitiator() const { 1183 WebContents* PrintPreviewHandler::GetInitiator() const {
1182 printing::PrintPreviewDialogController* dialog_controller = 1184 printing::PrintPreviewDialogController* dialog_controller =
1183 printing::PrintPreviewDialogController::GetInstance(); 1185 printing::PrintPreviewDialogController::GetInstance();
1184 if (!dialog_controller) 1186 if (!dialog_controller)
1185 return NULL; 1187 return NULL;
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 const local_discovery::DeviceDescription& description, 1562 const local_discovery::DeviceDescription& description,
1561 bool has_local_printing, 1563 bool has_local_printing,
1562 base::DictionaryValue* printer_value) { 1564 base::DictionaryValue* printer_value) {
1563 printer_value->SetString("serviceName", name); 1565 printer_value->SetString("serviceName", name);
1564 printer_value->SetString("name", description.name); 1566 printer_value->SetString("name", description.name);
1565 printer_value->SetBoolean("hasLocalPrinting", has_local_printing); 1567 printer_value->SetBoolean("hasLocalPrinting", has_local_printing);
1566 printer_value->SetBoolean("isUnregistered", description.id.empty()); 1568 printer_value->SetBoolean("isUnregistered", description.id.empty());
1567 } 1569 }
1568 1570
1569 #endif 1571 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698