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(printing::kSettingDisableScaling, |
633 web_ui()->CallJavascriptFunction("printScalingDisabledForSourcePDF"); | 633 params.is_scaling_disabled); |
| 634 options.SetInteger(printing::kSettingCopies, params.copies); |
| 635 web_ui()->CallJavascriptFunction("printPresetOptionsFromDocument", options); |
634 } | 636 } |
635 | 637 |
636 // static | 638 // static |
637 void PrintPreviewUI::SetDelegateForTesting(TestingDelegate* delegate) { | 639 void PrintPreviewUI::SetDelegateForTesting(TestingDelegate* delegate) { |
638 g_testing_delegate = delegate; | 640 g_testing_delegate = delegate; |
639 } | 641 } |
640 | 642 |
641 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { | 643 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { |
642 handler_->FileSelected(path, 0, NULL); | 644 handler_->FileSelected(path, 0, NULL); |
643 } | 645 } |
644 | 646 |
645 void PrintPreviewUI::SetPdfSavedClosureForTesting( | 647 void PrintPreviewUI::SetPdfSavedClosureForTesting( |
646 const base::Closure& closure) { | 648 const base::Closure& closure) { |
647 handler_->SetPdfSavedClosureForTesting(closure); | 649 handler_->SetPdfSavedClosureForTesting(closure); |
648 } | 650 } |
OLD | NEW |