OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_handler.h" | 5 #include "chrome/browser/ui/webui/print_preview_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #if !defined(OS_CHROMEOS) | 10 #if !defined(OS_CHROMEOS) |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
665 | 665 |
666 TabContents* initiator_tab = GetInitiatorTab(); | 666 TabContents* initiator_tab = GetInitiatorTab(); |
667 if (!initiator_tab) | 667 if (!initiator_tab) |
668 return; | 668 return; |
669 | 669 |
670 TabContentsWrapper* wrapper = | 670 TabContentsWrapper* wrapper = |
671 TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab); | 671 TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab); |
672 printing::PrintViewManager* manager = wrapper->print_view_manager(); | 672 printing::PrintViewManager* manager = wrapper->print_view_manager(); |
673 manager->set_observer(this); | 673 manager->set_observer(this); |
674 manager->PrintForSystemDialogNow(); | 674 manager->PrintForSystemDialogNow(); |
675 | |
676 // Cancel the pending preview request if exists. | |
677 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_); | |
678 print_preview_ui->OnCancelPendingPreviewRequest(); | |
Lei Zhang
2011/08/25 09:05:49
You can pull this, the associated PrintPreviewUI c
kmadhusu
2011/08/25 17:51:48
Done.
| |
675 } | 679 } |
676 | 680 |
677 void PrintPreviewHandler::HandleManagePrinters(const ListValue*) { | 681 void PrintPreviewHandler::HandleManagePrinters(const ListValue*) { |
678 ++manage_printers_dialog_request_count_; | 682 ++manage_printers_dialog_request_count_; |
679 printing::PrinterManagerDialog::ShowPrinterManagerDialog(); | 683 printing::PrinterManagerDialog::ShowPrinterManagerDialog(); |
680 } | 684 } |
681 | 685 |
682 void PrintPreviewHandler::HandleReloadCrashedInitiatorTab(const ListValue*) { | 686 void PrintPreviewHandler::HandleReloadCrashedInitiatorTab(const ListValue*) { |
683 ReportStats(); | 687 ReportStats(); |
684 ReportUserActionHistogram(INITIATOR_TAB_CRASHED); | 688 ReportUserActionHistogram(INITIATOR_TAB_CRASHED); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
923 return; | 927 return; |
924 | 928 |
925 // We no longer require the initiator tab details. Remove those details | 929 // We no longer require the initiator tab details. Remove those details |
926 // associated with the preview tab to allow the initiator tab to create | 930 // associated with the preview tab to allow the initiator tab to create |
927 // another preview tab. | 931 // another preview tab. |
928 printing::PrintPreviewTabController* tab_controller = | 932 printing::PrintPreviewTabController* tab_controller = |
929 printing::PrintPreviewTabController::GetInstance(); | 933 printing::PrintPreviewTabController::GetInstance(); |
930 if (tab_controller) | 934 if (tab_controller) |
931 tab_controller->EraseInitiatorTabInfo(preview_tab()); | 935 tab_controller->EraseInitiatorTabInfo(preview_tab()); |
932 } | 936 } |
OLD | NEW |