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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
621 delegate->GetWebDialogDelegate()->OnDialogClosed(std::string()); | 621 delegate->GetWebDialogDelegate()->OnDialogClosed(std::string()); |
622 delegate->OnDialogCloseFromWebUI(); | 622 delegate->OnDialogCloseFromWebUI(); |
623 } | 623 } |
624 | 624 |
625 void PrintPreviewUI::OnReloadPrintersList() { | 625 void PrintPreviewUI::OnReloadPrintersList() { |
626 web_ui()->CallJavascriptFunction("reloadPrintersList"); | 626 web_ui()->CallJavascriptFunction("reloadPrintersList"); |
627 } | 627 } |
628 | 628 |
629 void PrintPreviewUI::OnSetOptionsFromDocument( | 629 void PrintPreviewUI::OnSetOptionsFromDocument( |
630 const PrintHostMsg_SetOptionsFromDocument_Params& params) { | 630 const PrintHostMsg_SetOptionsFromDocument_Params& params) { |
631 // Notify WebUI that print scaling is disabled | 631 base::DictionaryValue options; |
632 if (params.is_scaling_disabled) | 632 options.SetBoolean( |
633 web_ui()->CallJavascriptFunction("printScalingDisabledForSourcePDF"); | 633 printing::kSettingFitToPageEnabled, |
Aleksey Shlyapnikov
2014/11/20 18:56:56
Why are you using kSettingFitToPageEnabled name he
Nikhil
2014/11/21 10:45:32
Thanks for reviewing this! I've introduced kSettin
| |
634 params.is_scaling_disabled); | |
635 options.SetInteger(printing::kSettingCopies, params.copies); | |
636 web_ui()->CallJavascriptFunction("printPresetOptionsFromDocument", options); | |
Aleksey Shlyapnikov
2014/11/20 18:56:56
Since you're not calling printScalingDisabledForSo
Nikhil
2014/11/21 10:45:32
Done.
| |
634 } | 637 } |
635 | 638 |
636 // static | 639 // static |
637 void PrintPreviewUI::SetDelegateForTesting(TestingDelegate* delegate) { | 640 void PrintPreviewUI::SetDelegateForTesting(TestingDelegate* delegate) { |
638 g_testing_delegate = delegate; | 641 g_testing_delegate = delegate; |
639 } | 642 } |
640 | 643 |
641 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { | 644 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { |
642 handler_->FileSelected(path, 0, NULL); | 645 handler_->FileSelected(path, 0, NULL); |
643 } | 646 } |
644 | 647 |
645 void PrintPreviewUI::SetPdfSavedClosureForTesting( | 648 void PrintPreviewUI::SetPdfSavedClosureForTesting( |
646 const base::Closure& closure) { | 649 const base::Closure& closure) { |
647 handler_->SetPdfSavedClosureForTesting(closure); | 650 handler_->SetPdfSavedClosureForTesting(closure); |
648 } | 651 } |
OLD | NEW |