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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (!base::Base64Encode(raw_data, &base64_data)) { | 1175 base::Base64Encode(raw_data, &base64_data); |
1176 NOTREACHED() << "Base64 encoding PDF data."; | |
1177 } | |
1178 StringValue data_value(base64_data); | 1176 StringValue data_value(base64_data); |
1179 | 1177 |
1180 web_ui()->CallJavascriptFunction("printToCloud", data_value); | 1178 web_ui()->CallJavascriptFunction("printToCloud", data_value); |
1181 } | 1179 } |
1182 | 1180 |
1183 WebContents* PrintPreviewHandler::GetInitiator() const { | 1181 WebContents* PrintPreviewHandler::GetInitiator() const { |
1184 printing::PrintPreviewDialogController* dialog_controller = | 1182 printing::PrintPreviewDialogController* dialog_controller = |
1185 printing::PrintPreviewDialogController::GetInstance(); | 1183 printing::PrintPreviewDialogController::GetInstance(); |
1186 if (!dialog_controller) | 1184 if (!dialog_controller) |
1187 return NULL; | 1185 return NULL; |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 | 1555 |
1558 void PrintPreviewHandler::FillPrinterDescription( | 1556 void PrintPreviewHandler::FillPrinterDescription( |
1559 const std::string& name, | 1557 const std::string& name, |
1560 const local_discovery::DeviceDescription& description, | 1558 const local_discovery::DeviceDescription& description, |
1561 base::DictionaryValue* printer_value) { | 1559 base::DictionaryValue* printer_value) { |
1562 printer_value->SetString("serviceName", name); | 1560 printer_value->SetString("serviceName", name); |
1563 printer_value->SetString("name", description.name); | 1561 printer_value->SetString("name", description.name); |
1564 } | 1562 } |
1565 | 1563 |
1566 #endif | 1564 #endif |
OLD | NEW |