Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7167)

Unified Diff: chrome/browser/ui/webui/print_preview_handler.cc

Issue 7202012: Print Preview: Display a throbber when the user requests the system print (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.h ('k') | chrome/browser/ui/webui/print_preview_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/print_preview_handler.cc
diff --git a/chrome/browser/ui/webui/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview_handler.cc
index 8d4aff67125967a527e2d81bc5646636d8274c36..8a141e6b6042e2856edfd8218178217980dbf829 100644
--- a/chrome/browser/ui/webui/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview_handler.cc
@@ -568,13 +568,12 @@ void PrintPreviewHandler::HandleShowSystemDialog(const ListValue* args) {
TabContents* initiator_tab = GetInitiatorTab();
if (!initiator_tab)
return;
- initiator_tab->Activate();
TabContentsWrapper* wrapper =
TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab);
- wrapper->print_view_manager()->PrintNow();
-
- ClosePrintPreviewTab();
+ printing::PrintViewManager* manager = wrapper->print_view_manager();
+ manager->set_observer(this);
+ manager->PrintNow();
}
void PrintPreviewHandler::HandleManagePrinters(const ListValue* args) {
@@ -647,6 +646,14 @@ void PrintPreviewHandler::ClosePrintPreviewTab() {
&preview_tab()->controller()), TabStripModel::CLOSE_NONE);
}
+void PrintPreviewHandler::OnPrintDialogShown() {
+ TabContents* initiator_tab = GetInitiatorTab();
+ DCHECK(initiator_tab);
+
+ initiator_tab->Activate();
+ ClosePrintPreviewTab();
+}
+
void PrintPreviewHandler::SelectFile(const FilePath& default_filename) {
SelectFileDialog::FileTypeInfo file_type_info;
file_type_info.extensions.resize(1);
@@ -677,6 +684,16 @@ void PrintPreviewHandler::SelectFile(const FilePath& default_filename) {
NULL);
}
+void PrintPreviewHandler::OnNavigation() {
+ TabContents* initiator_tab = GetInitiatorTab();
+ if (!initiator_tab)
+ return;
+
+ TabContentsWrapper* wrapper =
+ TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab);
+ wrapper->print_view_manager()->set_observer(NULL);
+}
+
void PrintPreviewHandler::FileSelected(const FilePath& path,
int index, void* params) {
PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
@@ -714,13 +731,14 @@ void PrintPreviewHandler::HidePreviewTab() {
void PrintPreviewHandler::ClearInitiatorTabDetails() {
TabContents* initiator_tab = GetInitiatorTab();
- if (initiator_tab) {
- // We no longer require the intiator tab details. Remove those details
- // associated with the preview tab to allow the initiator tab to create
- // another preview tab.
- printing::PrintPreviewTabController* tab_controller =
- printing::PrintPreviewTabController::GetInstance();
- if (tab_controller)
- tab_controller->EraseInitiatorTabInfo(preview_tab());
- }
+ if (!initiator_tab)
+ return;
+
+ // We no longer require the initiator tab details. Remove those details
+ // associated with the preview tab to allow the initiator tab to create
+ // another preview tab.
+ printing::PrintPreviewTabController* tab_controller =
+ printing::PrintPreviewTabController::GetInstance();
+ if (tab_controller)
+ tab_controller->EraseInitiatorTabInfo(preview_tab());
}
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.h ('k') | chrome/browser/ui/webui/print_preview_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698