| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 const local_discovery::DeviceDescription& description, | 1560 const local_discovery::DeviceDescription& description, |
| 1563 bool has_local_printing, | 1561 bool has_local_printing, |
| 1564 base::DictionaryValue* printer_value) { | 1562 base::DictionaryValue* printer_value) { |
| 1565 printer_value->SetString("serviceName", name); | 1563 printer_value->SetString("serviceName", name); |
| 1566 printer_value->SetString("name", description.name); | 1564 printer_value->SetString("name", description.name); |
| 1567 printer_value->SetBoolean("hasLocalPrinting", has_local_printing); | 1565 printer_value->SetBoolean("hasLocalPrinting", has_local_printing); |
| 1568 printer_value->SetBoolean("isUnregistered", description.id.empty()); | 1566 printer_value->SetBoolean("isUnregistered", description.id.empty()); |
| 1569 } | 1567 } |
| 1570 | 1568 |
| 1571 #endif | 1569 #endif |
| OLD | NEW |