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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 #include "content/public/browser/url_data_source.h" | 35 #include "content/public/browser/url_data_source.h" |
36 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
37 #include "content/public/browser/web_ui_data_source.h" | 37 #include "content/public/browser/web_ui_data_source.h" |
38 #include "printing/page_size_margins.h" | 38 #include "printing/page_size_margins.h" |
39 #include "printing/print_job_constants.h" | 39 #include "printing/print_job_constants.h" |
40 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
41 #include "ui/gfx/geometry/rect.h" | 41 #include "ui/gfx/geometry/rect.h" |
42 #include "ui/web_dialogs/web_dialog_delegate.h" | 42 #include "ui/web_dialogs/web_dialog_delegate.h" |
43 #include "ui/web_dialogs/web_dialog_ui.h" | 43 #include "ui/web_dialogs/web_dialog_ui.h" |
44 | 44 |
45 #if defined(OS_CHROMEOS) | |
46 #include "base/command_line.h" | |
47 #include "base/feature_list.h" | |
48 #include "chrome/common/chrome_features.h" | |
49 #include "chrome/common/chrome_switches.h" | |
50 #endif | |
51 | |
45 using content::WebContents; | 52 using content::WebContents; |
46 using printing::PageSizeMargins; | 53 using printing::PageSizeMargins; |
47 | 54 |
48 namespace { | 55 namespace { |
49 | 56 |
50 #if defined(OS_MACOSX) | 57 #if defined(OS_MACOSX) |
51 // U+0028 U+21E7 U+2318 U+0050 U+0029 in UTF8 | 58 // U+0028 U+21E7 U+2318 U+0050 U+0029 in UTF8 |
52 const char kBasicPrintShortcut[] = "\x28\xE2\x8c\xA5\xE2\x8C\x98\x50\x29"; | 59 const char kBasicPrintShortcut[] = "\x28\xE2\x8c\xA5\xE2\x8C\x98\x50\x29"; |
53 #elif defined(OS_WIN) || defined(OS_CHROMEOS) | 60 #elif defined(OS_WIN) || defined(OS_CHROMEOS) |
54 const char kBasicPrintShortcut[] = "(Ctrl+Shift+P)"; | 61 const char kBasicPrintShortcut[] = "(Ctrl+Shift+P)"; |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 source->AddResourcePath("images/mobile.png", IDR_PRINT_PREVIEW_IMAGES_MOBILE); | 393 source->AddResourcePath("images/mobile.png", IDR_PRINT_PREVIEW_IMAGES_MOBILE); |
387 source->AddResourcePath("images/mobile_shared.png", | 394 source->AddResourcePath("images/mobile_shared.png", |
388 IDR_PRINT_PREVIEW_IMAGES_MOBILE_SHARED); | 395 IDR_PRINT_PREVIEW_IMAGES_MOBILE_SHARED); |
389 source->SetDefaultResource(IDR_PRINT_PREVIEW_HTML); | 396 source->SetDefaultResource(IDR_PRINT_PREVIEW_HTML); |
390 source->SetRequestFilter(base::Bind(&HandleRequestCallback)); | 397 source->SetRequestFilter(base::Bind(&HandleRequestCallback)); |
391 source->OverrideContentSecurityPolicyChildSrc("child-src 'self';"); | 398 source->OverrideContentSecurityPolicyChildSrc("child-src 'self';"); |
392 source->DisableDenyXFrameOptions(); | 399 source->DisableDenyXFrameOptions(); |
393 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';"); | 400 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';"); |
394 source->AddLocalizedString("moreOptionsLabel", IDS_MORE_OPTIONS_LABEL); | 401 source->AddLocalizedString("moreOptionsLabel", IDS_MORE_OPTIONS_LABEL); |
395 source->AddLocalizedString("lessOptionsLabel", IDS_LESS_OPTIONS_LABEL); | 402 source->AddLocalizedString("lessOptionsLabel", IDS_LESS_OPTIONS_LABEL); |
403 #if defined(OS_CHROMEOS) | |
404 source->AddBoolean("showLocalManageButton", | |
405 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
406 ::switches::kEnableNativeCups) && | |
407 base::FeatureList::IsEnabled( | |
408 features::kMaterialDesignSettings)); | |
409 source->AddString("localPrintersManagementURL", | |
Dan Beam
2016/09/21 20:56:25
what do you think about this?
#if defined(OS_CHRO
xdai1
2016/09/21 23:38:53
Done.
| |
410 chrome::kChromeUIMdCupsSettingsURL); | |
411 #else | |
412 source->AddBoolean("showLocalManageButton", true); | |
Dan Beam
2016/09/21 19:12:02
i'm confused. why should this be true on !chromeo
xdai1
2016/09/21 19:56:24
"Manage" button has been on other systems before t
| |
413 #endif | |
396 return source; | 414 return source; |
397 } | 415 } |
398 | 416 |
399 PrintPreviewUI::TestingDelegate* g_testing_delegate = NULL; | 417 PrintPreviewUI::TestingDelegate* g_testing_delegate = NULL; |
400 | 418 |
401 } // namespace | 419 } // namespace |
402 | 420 |
403 PrintPreviewUI::PrintPreviewUI(content::WebUI* web_ui) | 421 PrintPreviewUI::PrintPreviewUI(content::WebUI* web_ui) |
404 : ConstrainedWebDialogUI(web_ui), | 422 : ConstrainedWebDialogUI(web_ui), |
405 initial_preview_start_time_(base::TimeTicks::Now()), | 423 initial_preview_start_time_(base::TimeTicks::Now()), |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
661 } | 679 } |
662 | 680 |
663 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { | 681 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { |
664 handler_->FileSelected(path, 0, NULL); | 682 handler_->FileSelected(path, 0, NULL); |
665 } | 683 } |
666 | 684 |
667 void PrintPreviewUI::SetPdfSavedClosureForTesting( | 685 void PrintPreviewUI::SetPdfSavedClosureForTesting( |
668 const base::Closure& closure) { | 686 const base::Closure& closure) { |
669 handler_->SetPdfSavedClosureForTesting(closure); | 687 handler_->SetPdfSavedClosureForTesting(closure); |
670 } | 688 } |
OLD | NEW |