| 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 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 source->OverrideContentSecurityPolicyScriptSrc( | 411 source->OverrideContentSecurityPolicyScriptSrc( |
| 412 base::StringPrintf("script-src chrome://resources 'self' 'unsafe-eval' " | 412 base::StringPrintf("script-src chrome://resources 'self' 'unsafe-eval' " |
| 413 "chrome-extension://%s;", | 413 "chrome-extension://%s;", |
| 414 extension_misc::kPdfExtensionId)); | 414 extension_misc::kPdfExtensionId)); |
| 415 source->OverrideContentSecurityPolicyChildSrc("child-src 'self';"); | 415 source->OverrideContentSecurityPolicyChildSrc("child-src 'self';"); |
| 416 source->DisableDenyXFrameOptions(); | 416 source->DisableDenyXFrameOptions(); |
| 417 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';"); | 417 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';"); |
| 418 source->AddLocalizedString("moreOptionsLabel", IDS_MORE_OPTIONS_LABEL); | 418 source->AddLocalizedString("moreOptionsLabel", IDS_MORE_OPTIONS_LABEL); |
| 419 source->AddLocalizedString("lessOptionsLabel", IDS_LESS_OPTIONS_LABEL); | 419 source->AddLocalizedString("lessOptionsLabel", IDS_LESS_OPTIONS_LABEL); |
| 420 | 420 |
| 421 bool scaling_enabled = base::FeatureList::IsEnabled(features::kPrintScaling); | |
| 422 source->AddBoolean("scalingEnabled", scaling_enabled); | |
| 423 | |
| 424 bool print_pdf_as_image_enabled = base::FeatureList::IsEnabled( | 421 bool print_pdf_as_image_enabled = base::FeatureList::IsEnabled( |
| 425 features::kPrintPdfAsImage); | 422 features::kPrintPdfAsImage); |
| 426 source->AddBoolean("printPdfAsImageEnabled", print_pdf_as_image_enabled); | 423 source->AddBoolean("printPdfAsImageEnabled", print_pdf_as_image_enabled); |
| 427 | |
| 428 #if defined(OS_CHROMEOS) | 424 #if defined(OS_CHROMEOS) |
| 429 bool cups_and_md_settings_enabled = | 425 bool cups_and_md_settings_enabled = |
| 430 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 426 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 431 ::switches::kDisableNativeCups); | 427 ::switches::kDisableNativeCups); |
| 432 source->AddBoolean("showLocalManageButton", cups_and_md_settings_enabled); | 428 source->AddBoolean("showLocalManageButton", cups_and_md_settings_enabled); |
| 433 #else | 429 #else |
| 434 source->AddBoolean("showLocalManageButton", true); | 430 source->AddBoolean("showLocalManageButton", true); |
| 435 #endif | 431 #endif |
| 436 return source; | 432 return source; |
| 437 } | 433 } |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 } | 689 } |
| 694 | 690 |
| 695 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { | 691 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { |
| 696 handler_->FileSelected(path, 0, NULL); | 692 handler_->FileSelected(path, 0, NULL); |
| 697 } | 693 } |
| 698 | 694 |
| 699 void PrintPreviewUI::SetPdfSavedClosureForTesting( | 695 void PrintPreviewUI::SetPdfSavedClosureForTesting( |
| 700 const base::Closure& closure) { | 696 const base::Closure& closure) { |
| 701 handler_->SetPdfSavedClosureForTesting(closure); | 697 handler_->SetPdfSavedClosureForTesting(closure); |
| 702 } | 698 } |
| OLD | NEW |