| 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_ui.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 #endif | 159 #endif |
| 160 source->AddLocalizedString("loading", IDS_PRINT_PREVIEW_LOADING); | 160 source->AddLocalizedString("loading", IDS_PRINT_PREVIEW_LOADING); |
| 161 source->AddLocalizedString("noPlugin", IDS_PRINT_PREVIEW_NO_PLUGIN); | 161 source->AddLocalizedString("noPlugin", IDS_PRINT_PREVIEW_NO_PLUGIN); |
| 162 source->AddLocalizedString("launchNativeDialog", | 162 source->AddLocalizedString("launchNativeDialog", |
| 163 IDS_PRINT_PREVIEW_NATIVE_DIALOG); | 163 IDS_PRINT_PREVIEW_NATIVE_DIALOG); |
| 164 source->AddLocalizedString("previewFailed", IDS_PRINT_PREVIEW_FAILED); | 164 source->AddLocalizedString("previewFailed", IDS_PRINT_PREVIEW_FAILED); |
| 165 source->AddLocalizedString("invalidPrinterSettings", | 165 source->AddLocalizedString("invalidPrinterSettings", |
| 166 IDS_PRINT_INVALID_PRINTER_SETTINGS); | 166 IDS_PRINT_INVALID_PRINTER_SETTINGS); |
| 167 source->AddLocalizedString("printButton", IDS_PRINT_PREVIEW_PRINT_BUTTON); | 167 source->AddLocalizedString("printButton", IDS_PRINT_PREVIEW_PRINT_BUTTON); |
| 168 source->AddLocalizedString("saveButton", IDS_PRINT_PREVIEW_SAVE_BUTTON); | 168 source->AddLocalizedString("saveButton", IDS_PRINT_PREVIEW_SAVE_BUTTON); |
| 169 source->AddLocalizedString("cancelButton", IDS_PRINT_PREVIEW_CANCEL_BUTTON); | |
| 170 source->AddLocalizedString("printing", IDS_PRINT_PREVIEW_PRINTING); | 169 source->AddLocalizedString("printing", IDS_PRINT_PREVIEW_PRINTING); |
| 171 source->AddLocalizedString("printingToPDFInProgress", | 170 source->AddLocalizedString("printingToPDFInProgress", |
| 172 IDS_PRINT_PREVIEW_PRINTING_TO_PDF_IN_PROGRESS); | 171 IDS_PRINT_PREVIEW_PRINTING_TO_PDF_IN_PROGRESS); |
| 173 #if defined(OS_MACOSX) | 172 #if defined(OS_MACOSX) |
| 174 source->AddLocalizedString("openingPDFInPreview", | 173 source->AddLocalizedString("openingPDFInPreview", |
| 175 IDS_PRINT_PREVIEW_OPENING_PDF_IN_PREVIEW); | 174 IDS_PRINT_PREVIEW_OPENING_PDF_IN_PREVIEW); |
| 176 #endif | 175 #endif |
| 177 source->AddLocalizedString("destinationLabel", | 176 source->AddLocalizedString("destinationLabel", |
| 178 IDS_PRINT_PREVIEW_DESTINATION_LABEL); | 177 IDS_PRINT_PREVIEW_DESTINATION_LABEL); |
| 179 source->AddLocalizedString("copiesLabel", IDS_PRINT_PREVIEW_COPIES_LABEL); | 178 source->AddLocalizedString("copiesLabel", IDS_PRINT_PREVIEW_COPIES_LABEL); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 source->AddLocalizedString("minimumMargins", | 268 source->AddLocalizedString("minimumMargins", |
| 270 IDS_PRINT_PREVIEW_MINIMUM_MARGINS); | 269 IDS_PRINT_PREVIEW_MINIMUM_MARGINS); |
| 271 source->AddLocalizedString("top", IDS_PRINT_PREVIEW_TOP_MARGIN_LABEL); | 270 source->AddLocalizedString("top", IDS_PRINT_PREVIEW_TOP_MARGIN_LABEL); |
| 272 source->AddLocalizedString("bottom", IDS_PRINT_PREVIEW_BOTTOM_MARGIN_LABEL); | 271 source->AddLocalizedString("bottom", IDS_PRINT_PREVIEW_BOTTOM_MARGIN_LABEL); |
| 273 source->AddLocalizedString("left", IDS_PRINT_PREVIEW_LEFT_MARGIN_LABEL); | 272 source->AddLocalizedString("left", IDS_PRINT_PREVIEW_LEFT_MARGIN_LABEL); |
| 274 source->AddLocalizedString("right", IDS_PRINT_PREVIEW_RIGHT_MARGIN_LABEL); | 273 source->AddLocalizedString("right", IDS_PRINT_PREVIEW_RIGHT_MARGIN_LABEL); |
| 275 source->AddLocalizedString("mediaSizeLabel", | 274 source->AddLocalizedString("mediaSizeLabel", |
| 276 IDS_PRINT_PREVIEW_MEDIA_SIZE_LABEL); | 275 IDS_PRINT_PREVIEW_MEDIA_SIZE_LABEL); |
| 277 source->AddLocalizedString("destinationSearchTitle", | 276 source->AddLocalizedString("destinationSearchTitle", |
| 278 IDS_PRINT_PREVIEW_DESTINATION_SEARCH_TITLE); | 277 IDS_PRINT_PREVIEW_DESTINATION_SEARCH_TITLE); |
| 279 source->AddLocalizedString("userInfo", IDS_PRINT_PREVIEW_USER_INFO); | |
| 280 source->AddLocalizedString("accountSelectTitle", | 278 source->AddLocalizedString("accountSelectTitle", |
| 281 IDS_PRINT_PREVIEW_ACCOUNT_SELECT_TITLE); | 279 IDS_PRINT_PREVIEW_ACCOUNT_SELECT_TITLE); |
| 282 source->AddLocalizedString("addAccountTitle", | 280 source->AddLocalizedString("addAccountTitle", |
| 283 IDS_PRINT_PREVIEW_ADD_ACCOUNT_TITLE); | 281 IDS_PRINT_PREVIEW_ADD_ACCOUNT_TITLE); |
| 284 source->AddLocalizedString("cloudPrintPromotion", | 282 source->AddLocalizedString("cloudPrintPromotion", |
| 285 IDS_PRINT_PREVIEW_CLOUD_PRINT_PROMOTION); | 283 IDS_PRINT_PREVIEW_CLOUD_PRINT_PROMOTION); |
| 286 source->AddLocalizedString("searchBoxPlaceholder", | 284 source->AddLocalizedString("searchBoxPlaceholder", |
| 287 IDS_PRINT_PREVIEW_SEARCH_BOX_PLACEHOLDER); | 285 IDS_PRINT_PREVIEW_SEARCH_BOX_PLACEHOLDER); |
| 288 source->AddLocalizedString("noDestinationsMessage", | 286 source->AddLocalizedString("noDestinationsMessage", |
| 289 IDS_PRINT_PREVIEW_NO_DESTINATIONS_MESSAGE); | 287 IDS_PRINT_PREVIEW_NO_DESTINATIONS_MESSAGE); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 source->AddLocalizedString( | 321 source->AddLocalizedString( |
| 324 "noDestsPromoAddPrinterButtonLabel", | 322 "noDestsPromoAddPrinterButtonLabel", |
| 325 IDS_PRINT_PREVIEW_NO_DESTS_PROMO_ADD_PRINTER_BUTTON_LABEL); | 323 IDS_PRINT_PREVIEW_NO_DESTS_PROMO_ADD_PRINTER_BUTTON_LABEL); |
| 326 source->AddLocalizedString( | 324 source->AddLocalizedString( |
| 327 "noDestsPromoNotNowButtonLabel", | 325 "noDestsPromoNotNowButtonLabel", |
| 328 IDS_PRINT_PREVIEW_NO_DESTS_PROMO_NOT_NOW_BUTTON_LABEL); | 326 IDS_PRINT_PREVIEW_NO_DESTS_PROMO_NOT_NOW_BUTTON_LABEL); |
| 329 source->AddLocalizedString("couldNotPrint", | 327 source->AddLocalizedString("couldNotPrint", |
| 330 IDS_PRINT_PREVIEW_COULD_NOT_PRINT); | 328 IDS_PRINT_PREVIEW_COULD_NOT_PRINT); |
| 331 source->AddLocalizedString("registerPromoButtonText", | 329 source->AddLocalizedString("registerPromoButtonText", |
| 332 IDS_PRINT_PREVIEW_REGISTER_PROMO_BUTTON_TEXT); | 330 IDS_PRINT_PREVIEW_REGISTER_PROMO_BUTTON_TEXT); |
| 331 source->AddLocalizedString( |
| 332 "advancedSettingsSearchBoxPlaceholder", |
| 333 IDS_PRINT_PREVIEW_ADVANCED_SETTINGS_SEARCH_BOX_PLACEHOLDER); |
| 334 source->AddLocalizedString("advancedSettingsDialogTitle", |
| 335 IDS_PRINT_PREVIEW_ADVANCED_SETTINGS_DIALOG_TITLE); |
| 336 source->AddLocalizedString( |
| 337 "advancedSettingsDialogConfirm", |
| 338 IDS_PRINT_PREVIEW_ADVANCED_SETTINGS_DIALOG_CONFIRM); |
| 339 source->AddLocalizedString("cancel", IDS_CANCEL); |
| 333 | 340 |
| 334 source->SetJsonPath("strings.js"); | 341 source->SetJsonPath("strings.js"); |
| 335 source->AddResourcePath("print_preview.js", IDR_PRINT_PREVIEW_JS); | 342 source->AddResourcePath("print_preview.js", IDR_PRINT_PREVIEW_JS); |
| 336 source->AddResourcePath("images/printer.png", | 343 source->AddResourcePath("images/printer.png", |
| 337 IDR_PRINT_PREVIEW_IMAGES_PRINTER); | 344 IDR_PRINT_PREVIEW_IMAGES_PRINTER); |
| 338 source->AddResourcePath("images/printer_shared.png", | 345 source->AddResourcePath("images/printer_shared.png", |
| 339 IDR_PRINT_PREVIEW_IMAGES_PRINTER_SHARED); | 346 IDR_PRINT_PREVIEW_IMAGES_PRINTER_SHARED); |
| 340 source->AddResourcePath("images/third_party.png", | 347 source->AddResourcePath("images/third_party.png", |
| 341 IDR_PRINT_PREVIEW_IMAGES_THIRD_PARTY); | 348 IDR_PRINT_PREVIEW_IMAGES_THIRD_PARTY); |
| 342 source->AddResourcePath("images/third_party_fedex.png", | 349 source->AddResourcePath("images/third_party_fedex.png", |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 } | 610 } |
| 604 | 611 |
| 605 void PrintPreviewUI::OnPrintPreviewScalingDisabled() { | 612 void PrintPreviewUI::OnPrintPreviewScalingDisabled() { |
| 606 web_ui()->CallJavascriptFunction("printScalingDisabledForSourcePDF"); | 613 web_ui()->CallJavascriptFunction("printScalingDisabledForSourcePDF"); |
| 607 } | 614 } |
| 608 | 615 |
| 609 // static | 616 // static |
| 610 void PrintPreviewUI::SetDelegateForTesting(TestingDelegate* delegate) { | 617 void PrintPreviewUI::SetDelegateForTesting(TestingDelegate* delegate) { |
| 611 g_testing_delegate = delegate; | 618 g_testing_delegate = delegate; |
| 612 } | 619 } |
| OLD | NEW |