Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_ui.cc

Issue 2524143003: Print Preview: Add option to rasterize PDFs and add JPEG compression. (Closed)
Patch Set: Clean up JS Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include <vector> 8 #include <vector>
9 9
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 source->AddLocalizedString("optionsLabel", IDS_PRINT_PREVIEW_OPTIONS_LABEL); 271 source->AddLocalizedString("optionsLabel", IDS_PRINT_PREVIEW_OPTIONS_LABEL);
272 source->AddLocalizedString("optionHeaderFooter", 272 source->AddLocalizedString("optionHeaderFooter",
273 IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER); 273 IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER);
274 source->AddLocalizedString("optionFitToPage", 274 source->AddLocalizedString("optionFitToPage",
275 IDS_PRINT_PREVIEW_OPTION_FIT_TO_PAGE); 275 IDS_PRINT_PREVIEW_OPTION_FIT_TO_PAGE);
276 source->AddLocalizedString( 276 source->AddLocalizedString(
277 "optionBackgroundColorsAndImages", 277 "optionBackgroundColorsAndImages",
278 IDS_PRINT_PREVIEW_OPTION_BACKGROUND_COLORS_AND_IMAGES); 278 IDS_PRINT_PREVIEW_OPTION_BACKGROUND_COLORS_AND_IMAGES);
279 source->AddLocalizedString("optionSelectionOnly", 279 source->AddLocalizedString("optionSelectionOnly",
280 IDS_PRINT_PREVIEW_OPTION_SELECTION_ONLY); 280 IDS_PRINT_PREVIEW_OPTION_SELECTION_ONLY);
281 source->AddLocalizedString("optionRasterize",
282 IDS_PRINT_PREVIEW_OPTION_RASTERIZE);
281 source->AddLocalizedString("marginsLabel", IDS_PRINT_PREVIEW_MARGINS_LABEL); 283 source->AddLocalizedString("marginsLabel", IDS_PRINT_PREVIEW_MARGINS_LABEL);
282 source->AddLocalizedString("defaultMargins", 284 source->AddLocalizedString("defaultMargins",
283 IDS_PRINT_PREVIEW_DEFAULT_MARGINS); 285 IDS_PRINT_PREVIEW_DEFAULT_MARGINS);
284 source->AddLocalizedString("noMargins", IDS_PRINT_PREVIEW_NO_MARGINS); 286 source->AddLocalizedString("noMargins", IDS_PRINT_PREVIEW_NO_MARGINS);
285 source->AddLocalizedString("customMargins", IDS_PRINT_PREVIEW_CUSTOM_MARGINS); 287 source->AddLocalizedString("customMargins", IDS_PRINT_PREVIEW_CUSTOM_MARGINS);
286 source->AddLocalizedString("minimumMargins", 288 source->AddLocalizedString("minimumMargins",
287 IDS_PRINT_PREVIEW_MINIMUM_MARGINS); 289 IDS_PRINT_PREVIEW_MINIMUM_MARGINS);
288 source->AddLocalizedString("top", IDS_PRINT_PREVIEW_TOP_MARGIN_LABEL); 290 source->AddLocalizedString("top", IDS_PRINT_PREVIEW_TOP_MARGIN_LABEL);
289 source->AddLocalizedString("bottom", IDS_PRINT_PREVIEW_BOTTOM_MARGIN_LABEL); 291 source->AddLocalizedString("bottom", IDS_PRINT_PREVIEW_BOTTOM_MARGIN_LABEL);
290 source->AddLocalizedString("left", IDS_PRINT_PREVIEW_LEFT_MARGIN_LABEL); 292 source->AddLocalizedString("left", IDS_PRINT_PREVIEW_LEFT_MARGIN_LABEL);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 extension_misc::kPdfExtensionId)); 405 extension_misc::kPdfExtensionId));
404 source->OverrideContentSecurityPolicyChildSrc("child-src 'self';"); 406 source->OverrideContentSecurityPolicyChildSrc("child-src 'self';");
405 source->DisableDenyXFrameOptions(); 407 source->DisableDenyXFrameOptions();
406 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';"); 408 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';");
407 source->AddLocalizedString("moreOptionsLabel", IDS_MORE_OPTIONS_LABEL); 409 source->AddLocalizedString("moreOptionsLabel", IDS_MORE_OPTIONS_LABEL);
408 source->AddLocalizedString("lessOptionsLabel", IDS_LESS_OPTIONS_LABEL); 410 source->AddLocalizedString("lessOptionsLabel", IDS_LESS_OPTIONS_LABEL);
409 411
410 bool scaling_enabled = base::FeatureList::IsEnabled(features::kPrintScaling); 412 bool scaling_enabled = base::FeatureList::IsEnabled(features::kPrintScaling);
411 source->AddBoolean("scalingEnabled", scaling_enabled); 413 source->AddBoolean("scalingEnabled", scaling_enabled);
412 414
415 bool print_pdf_as_image_enabled = base::FeatureList::IsEnabled(
416 features::kPrintPdfAsImage);
417 source->AddBoolean("printPdfAsImageEnabled", print_pdf_as_image_enabled);
418
413 #if defined(OS_CHROMEOS) 419 #if defined(OS_CHROMEOS)
414 bool cups_and_md_settings_enabled = 420 bool cups_and_md_settings_enabled =
415 base::CommandLine::ForCurrentProcess()->HasSwitch( 421 base::CommandLine::ForCurrentProcess()->HasSwitch(
416 ::switches::kEnableNativeCups); 422 ::switches::kEnableNativeCups);
417 source->AddBoolean("showLocalManageButton", cups_and_md_settings_enabled); 423 source->AddBoolean("showLocalManageButton", cups_and_md_settings_enabled);
418 #else 424 #else
419 source->AddBoolean("showLocalManageButton", true); 425 source->AddBoolean("showLocalManageButton", true);
420 #endif 426 #endif
421 return source; 427 return source;
422 } 428 }
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 } 693 }
688 694
689 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { 695 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) {
690 handler_->FileSelected(path, 0, NULL); 696 handler_->FileSelected(path, 0, NULL);
691 } 697 }
692 698
693 void PrintPreviewUI::SetPdfSavedClosureForTesting( 699 void PrintPreviewUI::SetPdfSavedClosureForTesting(
694 const base::Closure& closure) { 700 const base::Closure& closure) {
695 handler_->SetPdfSavedClosureForTesting(closure); 701 handler_->SetPdfSavedClosureForTesting(closure);
696 } 702 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698