| 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_data_source.h" | 5 #include "chrome/browser/ui/webui/print_preview_data_source.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 IDS_PRINT_PREVIEW_SUMMARY_FORMAT_LONG); | 86 IDS_PRINT_PREVIEW_SUMMARY_FORMAT_LONG); |
| 87 AddLocalizedString("printPreviewSheetsLabelSingular", | 87 AddLocalizedString("printPreviewSheetsLabelSingular", |
| 88 IDS_PRINT_PREVIEW_SHEETS_LABEL_SINGULAR); | 88 IDS_PRINT_PREVIEW_SHEETS_LABEL_SINGULAR); |
| 89 AddLocalizedString("printPreviewSheetsLabelPlural", | 89 AddLocalizedString("printPreviewSheetsLabelPlural", |
| 90 IDS_PRINT_PREVIEW_SHEETS_LABEL_PLURAL); | 90 IDS_PRINT_PREVIEW_SHEETS_LABEL_PLURAL); |
| 91 AddLocalizedString("printPreviewPageLabelSingular", | 91 AddLocalizedString("printPreviewPageLabelSingular", |
| 92 IDS_PRINT_PREVIEW_PAGE_LABEL_SINGULAR); | 92 IDS_PRINT_PREVIEW_PAGE_LABEL_SINGULAR); |
| 93 AddLocalizedString("printPreviewPageLabelPlural", | 93 AddLocalizedString("printPreviewPageLabelPlural", |
| 94 IDS_PRINT_PREVIEW_PAGE_LABEL_PLURAL); | 94 IDS_PRINT_PREVIEW_PAGE_LABEL_PLURAL); |
| 95 const string16 shortcut_text(UTF8ToUTF16(kAdvancedPrintShortcut)); | 95 const string16 shortcut_text(UTF8ToUTF16(kAdvancedPrintShortcut)); |
| 96 #if defined(OS_CHROMEOS) | |
| 97 AddString("cloudPrintDialogOption", l10n_util::GetStringFUTF16( | |
| 98 IDS_PRINT_PREVIEW_CLOUD_DIALOG_OPTION, | |
| 99 shortcut_text)); | |
| 100 AddLocalizedString("printWithCloudPrint", | |
| 101 IDS_PRINT_PREVIEW_MORE_PRINTERS); | |
| 102 #else | |
| 103 AddString("systemDialogOption", l10n_util::GetStringFUTF16( | 96 AddString("systemDialogOption", l10n_util::GetStringFUTF16( |
| 104 IDS_PRINT_PREVIEW_SYSTEM_DIALOG_OPTION, | 97 IDS_PRINT_PREVIEW_SYSTEM_DIALOG_OPTION, |
| 105 shortcut_text)); | 98 shortcut_text)); |
| 106 AddLocalizedString("printWithCloudPrint", | 99 |
| 107 IDS_PRINT_PREVIEW_PRINT_WITH_CLOUD_PRINT); | |
| 108 #endif | |
| 109 AddLocalizedString("pageRangeInstruction", | 100 AddLocalizedString("pageRangeInstruction", |
| 110 IDS_PRINT_PREVIEW_PAGE_RANGE_INSTRUCTION); | 101 IDS_PRINT_PREVIEW_PAGE_RANGE_INSTRUCTION); |
| 111 AddLocalizedString("copiesInstruction", IDS_PRINT_PREVIEW_COPIES_INSTRUCTION); | 102 AddLocalizedString("copiesInstruction", IDS_PRINT_PREVIEW_COPIES_INSTRUCTION); |
| 112 AddLocalizedString("signIn", IDS_PRINT_PREVIEW_SIGN_IN); | 103 AddLocalizedString("signIn", IDS_PRINT_PREVIEW_SIGN_IN); |
| 104 AddLocalizedString("cloudPrinters", IDS_PRINT_PREVIEW_CLOUD_PRINTERS); |
| 105 AddLocalizedString("localPrinters", IDS_PRINT_PREVIEW_LOCAL_PRINTERS); |
| 106 AddLocalizedString("manageCloudPrinters", |
| 107 IDS_PRINT_PREVIEW_MANAGE_CLOUD_PRINTERS); |
| 108 AddLocalizedString("manageLocalPrinters", |
| 109 IDS_PRINT_PREVIEW_MANAGE_LOCAL_PRINTERS); |
| 113 AddLocalizedString("managePrinters", IDS_PRINT_PREVIEW_MANAGE_PRINTERS); | 110 AddLocalizedString("managePrinters", IDS_PRINT_PREVIEW_MANAGE_PRINTERS); |
| 114 AddLocalizedString("printWithCloudPrintWait", | 111 AddLocalizedString("printWithCloudPrintWait", |
| 115 IDS_PRINT_PREVIEW_PRINT_WITH_CLOUD_PRINT_WAIT); | 112 IDS_PRINT_PREVIEW_PRINT_WITH_CLOUD_PRINT_WAIT); |
| 113 AddLocalizedString("printWithCloudPrint", |
| 114 IDS_PRINT_PREVIEW_PRINT_WITH_CLOUD_PRINT); |
| 116 AddLocalizedString("incrementTitle", IDS_PRINT_PREVIEW_INCREMENT_TITLE); | 115 AddLocalizedString("incrementTitle", IDS_PRINT_PREVIEW_INCREMENT_TITLE); |
| 117 AddLocalizedString("decrementTitle", IDS_PRINT_PREVIEW_DECREMENT_TITLE); | 116 AddLocalizedString("decrementTitle", IDS_PRINT_PREVIEW_DECREMENT_TITLE); |
| 118 AddLocalizedString("printPagesLabel", IDS_PRINT_PREVIEW_PRINT_PAGES_LABEL); | 117 AddLocalizedString("printPagesLabel", IDS_PRINT_PREVIEW_PRINT_PAGES_LABEL); |
| 119 AddLocalizedString("optionsLabel", IDS_PRINT_PREVIEW_OPTIONS_LABEL); | 118 AddLocalizedString("optionsLabel", IDS_PRINT_PREVIEW_OPTIONS_LABEL); |
| 120 AddLocalizedString("optionHeaderFooter", | 119 AddLocalizedString("optionHeaderFooter", |
| 121 IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER); | 120 IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER); |
| 122 AddLocalizedString("marginsLabel", IDS_PRINT_PREVIEW_MARGINS_LABEL); | 121 AddLocalizedString("marginsLabel", IDS_PRINT_PREVIEW_MARGINS_LABEL); |
| 123 AddLocalizedString("defaultMargins", IDS_PRINT_PREVIEW_DEFAULT_MARGINS); | 122 AddLocalizedString("defaultMargins", IDS_PRINT_PREVIEW_DEFAULT_MARGINS); |
| 124 AddLocalizedString("noMargins", IDS_PRINT_PREVIEW_NO_MARGINS); | 123 AddLocalizedString("noMargins", IDS_PRINT_PREVIEW_NO_MARGINS); |
| 125 AddLocalizedString("customMargins", IDS_PRINT_PREVIEW_CUSTOM_MARGINS); | 124 AddLocalizedString("customMargins", IDS_PRINT_PREVIEW_CUSTOM_MARGINS); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 151 url_substr[0], page_index, &data); | 150 url_substr[0], page_index, &data); |
| 152 } | 151 } |
| 153 if (data.get()) { | 152 if (data.get()) { |
| 154 SendResponse(request_id, data); | 153 SendResponse(request_id, data); |
| 155 return; | 154 return; |
| 156 } | 155 } |
| 157 // Invalid request. | 156 // Invalid request. |
| 158 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); | 157 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); |
| 159 SendResponse(request_id, empty_bytes); | 158 SendResponse(request_id, empty_bytes); |
| 160 } | 159 } |
| OLD | NEW |