| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ui_html_source.h" | 5 #include "chrome/browser/ui/webui/print_preview_ui_html_source.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 void SetLocalizedStrings(DictionaryValue* localized_strings) { | 26 void SetLocalizedStrings(DictionaryValue* localized_strings) { |
| 27 localized_strings->SetString(std::string("title"), | 27 localized_strings->SetString(std::string("title"), |
| 28 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_TITLE)); | 28 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_TITLE)); |
| 29 localized_strings->SetString(std::string("loading"), | 29 localized_strings->SetString(std::string("loading"), |
| 30 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_LOADING)); | 30 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_LOADING)); |
| 31 localized_strings->SetString(std::string("loadingPrinters"), |
| 32 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_LOADING_PRINTERS)); |
| 31 #if defined(GOOGLE_CHROME_BUILD) | 33 #if defined(GOOGLE_CHROME_BUILD) |
| 32 localized_strings->SetString(std::string("noPlugin"), | 34 localized_strings->SetString(std::string("noPlugin"), |
| 33 l10n_util::GetStringFUTF8(IDS_PRINT_PREVIEW_NO_PLUGIN, | 35 l10n_util::GetStringFUTF8(IDS_PRINT_PREVIEW_NO_PLUGIN, |
| 34 ASCIIToUTF16("chrome://plugins/"))); | 36 ASCIIToUTF16("chrome://plugins/"))); |
| 35 #else | 37 #else |
| 36 localized_strings->SetString(std::string("noPlugin"), | 38 localized_strings->SetString(std::string("noPlugin"), |
| 37 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_NO_PLUGIN)); | 39 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_NO_PLUGIN)); |
| 38 #endif | 40 #endif |
| 39 localized_strings->SetString(std::string("previewFailed"), | 41 localized_strings->SetString(std::string("previewFailed"), |
| 40 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_FAILED)); | 42 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_FAILED)); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 localized_strings->SetString(std::string("printPreviewPageLabelSingular"), | 97 localized_strings->SetString(std::string("printPreviewPageLabelSingular"), |
| 96 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_PAGE_LABEL_SINGULAR)); | 98 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_PAGE_LABEL_SINGULAR)); |
| 97 localized_strings->SetString(std::string("printPreviewPageLabelPlural"), | 99 localized_strings->SetString(std::string("printPreviewPageLabelPlural"), |
| 98 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_PAGE_LABEL_PLURAL)); | 100 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_PAGE_LABEL_PLURAL)); |
| 99 localized_strings->SetString(std::string("systemDialogOption"), | 101 localized_strings->SetString(std::string("systemDialogOption"), |
| 100 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_SYSTEM_DIALOG_OPTION)); | 102 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_SYSTEM_DIALOG_OPTION)); |
| 101 localized_strings->SetString(std::string("pageRangeInstruction"), | 103 localized_strings->SetString(std::string("pageRangeInstruction"), |
| 102 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_PAGE_RANGE_INSTRUCTION)); | 104 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_PAGE_RANGE_INSTRUCTION)); |
| 103 localized_strings->SetString(std::string("copiesInstruction"), | 105 localized_strings->SetString(std::string("copiesInstruction"), |
| 104 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_COPIES_INSTRUCTION)); | 106 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_COPIES_INSTRUCTION)); |
| 105 localized_strings->SetString(std::string("managePrinters"), | 107 localized_strings->SetString(std::string("signIn"), |
| 106 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_MANAGE_PRINTERS)); | 108 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_SIGN_IN)); |
| 109 localized_strings->SetString(std::string("morePrinters"), |
| 110 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_MORE_PRINTERS)); |
| 111 localized_strings->SetString(std::string("addCloudPrinter"), |
| 112 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_ADD_CLOUD_PRINTER)); |
| 113 localized_strings->SetString(std::string("cloudPrinters"), |
| 114 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_CLOUD_PRINTERS)); |
| 115 localized_strings->SetString(std::string("localPrinters"), |
| 116 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_LOCAL_PRINTERS)); |
| 117 localized_strings->SetString(std::string("manageCloudPrinters"), |
| 118 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_MANAGE_CLOUD_PRINTERS)); |
| 119 localized_strings->SetString(std::string("manageLocalPrinters"), |
| 120 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_MANAGE_LOCAL_PRINTERS)); |
| 107 localized_strings->SetString(std::string("didYouMean"), | 121 localized_strings->SetString(std::string("didYouMean"), |
| 108 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_DID_YOU_MEAN)); | 122 l10n_util::GetStringUTF8(IDS_PRINT_PREVIEW_DID_YOU_MEAN)); |
| 109 } | 123 } |
| 110 | 124 |
| 111 } // namespace | 125 } // namespace |
| 112 | 126 |
| 113 PrintPreviewUIHTMLSource::PrintPreviewUIHTMLSource() | 127 PrintPreviewUIHTMLSource::PrintPreviewUIHTMLSource() |
| 114 : DataSource(chrome::kChromeUIPrintHost, MessageLoop::current()), | 128 : DataSource(chrome::kChromeUIPrintHost, MessageLoop::current()), |
| 115 data_(std::make_pair(static_cast<base::SharedMemory*>(NULL), 0U)) { | 129 data_(std::make_pair(static_cast<base::SharedMemory*>(NULL), 0U)) { |
| 116 } | 130 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 185 } |
| 172 | 186 |
| 173 std::string PrintPreviewUIHTMLSource::GetMimeType( | 187 std::string PrintPreviewUIHTMLSource::GetMimeType( |
| 174 const std::string& path) const { | 188 const std::string& path) const { |
| 175 // Print Preview Index page. | 189 // Print Preview Index page. |
| 176 if (path.empty()) | 190 if (path.empty()) |
| 177 return "text/html"; | 191 return "text/html"; |
| 178 // Print Preview data. | 192 // Print Preview data. |
| 179 return "application/pdf"; | 193 return "application/pdf"; |
| 180 } | 194 } |
| OLD | NEW |