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

Side by Side Diff: chrome/browser/printing/print_view_manager.cc

Issue 7721001: PrintPreview: Make ctrl-shift-p start the native print flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/printing/print_view_manager.h" 5 #include "chrome/browser/printing/print_view_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/printing/print_job.h" 10 #include "chrome/browser/printing/print_job.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 bool PrintViewManager::PrintNow() { 83 bool PrintViewManager::PrintNow() {
84 return PrintNowInternal(new PrintMsg_PrintPages(routing_id())); 84 return PrintNowInternal(new PrintMsg_PrintPages(routing_id()));
85 } 85 }
86 86
87 bool PrintViewManager::PrintForSystemDialogNow() { 87 bool PrintViewManager::PrintForSystemDialogNow() {
88 return PrintNowInternal(new PrintMsg_PrintForSystemDialog(routing_id())); 88 return PrintNowInternal(new PrintMsg_PrintForSystemDialog(routing_id()));
89 } 89 }
90 90
91 bool PrintViewManager::AdvancedPrintNow() {
92 printing::PrintPreviewTabController* tab_controller =
93 printing::PrintPreviewTabController::GetInstance();
94 if (!tab_controller)
95 return false;
96 TabContents* print_preview_tab =
97 tab_controller->GetPrintPreviewForTab(tab_contents());
98 if (print_preview_tab) {
99 // Preview tab exist for current tab or current tab is preview tab.
Lei Zhang 2011/08/24 01:27:28 In this case, I think you just want to close |prin
kmadhusu 2011/08/25 02:15:20 I tried to delete preview tab wrapper and to call
100 if (!print_preview_tab->web_ui())
101 return false;
102 PrintPreviewUI* print_preview_ui =
103 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui());
104 print_preview_ui->OnShowSystemDialog();
105 } else {
106 PrintNow();
107 }
108 return true;
109 }
110
91 bool PrintViewManager::PrintPreviewNow() { 111 bool PrintViewManager::PrintPreviewNow() {
92 return PrintNowInternal(new PrintMsg_InitiatePrintPreview(routing_id())); 112 return PrintNowInternal(new PrintMsg_InitiatePrintPreview(routing_id()));
93 } 113 }
94 114
95 void PrintViewManager::PreviewPrintingRequestCancelled() { 115 void PrintViewManager::PreviewPrintingRequestCancelled() {
96 if (!tab_contents()) 116 if (!tab_contents())
97 return; 117 return;
98 RenderViewHost* rvh = tab_contents()->render_view_host(); 118 RenderViewHost* rvh = tab_contents()->render_view_host();
99 rvh->Send(new PrintMsg_PreviewPrintingRequestCancelled(rvh->routing_id())); 119 rvh->Send(new PrintMsg_PreviewPrintingRequestCancelled(rvh->routing_id()));
100 } 120 }
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 } 528 }
509 529
510 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { 530 bool PrintViewManager::PrintNowInternal(IPC::Message* message) {
511 // Don't print / print preview interstitials. 531 // Don't print / print preview interstitials.
512 if (tab_contents()->showing_interstitial_page()) 532 if (tab_contents()->showing_interstitial_page())
513 return false; 533 return false;
514 return Send(message); 534 return Send(message);
515 } 535 }
516 536
517 } // namespace printing 537 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698