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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
655 | 655 |
656 void PrintPreviewHandler::HandleManageCloudPrint(const ListValue*) { | 656 void PrintPreviewHandler::HandleManageCloudPrint(const ListValue*) { |
657 Browser* browser = BrowserList::GetLastActive(); | 657 Browser* browser = BrowserList::GetLastActive(); |
658 browser->OpenURL(CloudPrintURL(browser->profile()). | 658 browser->OpenURL(CloudPrintURL(browser->profile()). |
659 GetCloudPrintServiceManageURL(), | 659 GetCloudPrintServiceManageURL(), |
660 GURL(), | 660 GURL(), |
661 NEW_FOREGROUND_TAB, | 661 NEW_FOREGROUND_TAB, |
662 PageTransition::LINK); | 662 PageTransition::LINK); |
663 } | 663 } |
664 | 664 |
665 void PrintPreviewHandler::HandleShowSystemDialog(const ListValue* args) { | 665 void PrintPreviewHandler::HandleShowSystemDialog(const ListValue*) { |
Lei Zhang
2011/08/24 01:27:28
This is just going to conflict with my cleanup CL.
kmadhusu
2011/08/25 02:15:20
okay :)
| |
666 ReportStats(); | 666 ReportStats(); |
667 ReportUserActionHistogram(FALLBACK_TO_ADVANCED_SETTINGS_DIALOG); | 667 ReportUserActionHistogram(FALLBACK_TO_ADVANCED_SETTINGS_DIALOG); |
668 | 668 |
669 TabContents* initiator_tab = GetInitiatorTab(); | 669 TabContents* initiator_tab = GetInitiatorTab(); |
670 if (!initiator_tab) | 670 if (!initiator_tab) |
671 return; | 671 return; |
672 | 672 |
673 TabContentsWrapper* wrapper = | 673 TabContentsWrapper* wrapper = |
674 TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab); | 674 TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab); |
675 printing::PrintViewManager* manager = wrapper->print_view_manager(); | 675 printing::PrintViewManager* manager = wrapper->print_view_manager(); |
676 manager->set_observer(this); | 676 manager->set_observer(this); |
677 manager->PrintForSystemDialogNow(); | 677 manager->PrintForSystemDialogNow(); |
678 | |
679 // Cancel the pending preview request if exists. | |
680 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_); | |
681 print_preview_ui->OnPrintPreviewRequest(-1); | |
Lei Zhang
2011/08/24 01:27:28
Let's add a new method to PrintPreviewUI to do can
kmadhusu
2011/08/25 02:15:20
Done.
| |
678 } | 682 } |
679 | 683 |
680 void PrintPreviewHandler::HandleManagePrinters(const ListValue* args) { | 684 void PrintPreviewHandler::HandleManagePrinters(const ListValue* args) { |
681 ++manage_printers_dialog_request_count_; | 685 ++manage_printers_dialog_request_count_; |
682 printing::PrinterManagerDialog::ShowPrinterManagerDialog(); | 686 printing::PrinterManagerDialog::ShowPrinterManagerDialog(); |
683 } | 687 } |
684 | 688 |
685 void PrintPreviewHandler::HandleReloadCrashedInitiatorTab(const ListValue*) { | 689 void PrintPreviewHandler::HandleReloadCrashedInitiatorTab(const ListValue*) { |
686 ReportStats(); | 690 ReportStats(); |
687 ReportUserActionHistogram(INITIATOR_TAB_CRASHED); | 691 ReportUserActionHistogram(INITIATOR_TAB_CRASHED); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
926 return; | 930 return; |
927 | 931 |
928 // We no longer require the initiator tab details. Remove those details | 932 // We no longer require the initiator tab details. Remove those details |
929 // associated with the preview tab to allow the initiator tab to create | 933 // associated with the preview tab to allow the initiator tab to create |
930 // another preview tab. | 934 // another preview tab. |
931 printing::PrintPreviewTabController* tab_controller = | 935 printing::PrintPreviewTabController* tab_controller = |
932 printing::PrintPreviewTabController::GetInstance(); | 936 printing::PrintPreviewTabController::GetInstance(); |
933 if (tab_controller) | 937 if (tab_controller) |
934 tab_controller->EraseInitiatorTabInfo(preview_tab()); | 938 tab_controller->EraseInitiatorTabInfo(preview_tab()); |
935 } | 939 } |
OLD | NEW |