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

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

Issue 10829463: Print preview: Handle all tab navigations in PrintPreviewTabController instead of in two places. Ha… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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) 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/printing/print_preview_message_handler.h" 5 #include "chrome/browser/printing/print_preview_message_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/ref_counted_memory.h" 11 #include "base/memory/ref_counted_memory.h"
12 #include "base/shared_memory.h" 12 #include "base/shared_memory.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/printing/print_job_manager.h" 14 #include "chrome/browser/printing/print_job_manager.h"
15 #include "chrome/browser/printing/print_preview_tab_controller.h" 15 #include "chrome/browser/printing/print_preview_tab_controller.h"
16 #include "chrome/browser/printing/print_view_manager.h" 16 #include "chrome/browser/printing/print_view_manager.h"
17 #include "chrome/browser/printing/printer_query.h" 17 #include "chrome/browser/printing/printer_query.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents.h"
19 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" 19 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
20 #include "chrome/common/print_messages.h" 20 #include "chrome/common/print_messages.h"
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/browser/web_ui.h" 24 #include "content/public/browser/web_ui.h"
25 #include "printing/page_size_margins.h" 25 #include "printing/page_size_margins.h"
26 #include "printing/print_job_constants.h" 26 #include "printing/print_job_constants.h"
27 27
28 using content::BrowserThread; 28 using content::BrowserThread;
29 using content::NavigationController;
30 using content::WebContents; 29 using content::WebContents;
31 30
32 namespace { 31 namespace {
33 32
34 void StopWorker(int document_cookie) { 33 void StopWorker(int document_cookie) {
35 if (document_cookie <= 0) 34 if (document_cookie <= 0)
36 return; 35 return;
37 36
38 printing::PrintJobManager* print_job_manager = 37 printing::PrintJobManager* print_job_manager =
39 g_browser_process->print_job_manager(); 38 g_browser_process->print_job_manager();
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 OnPrintPreviewCancelled) 240 OnPrintPreviewCancelled)
242 IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewInvalidPrinterSettings, 241 IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewInvalidPrinterSettings,
243 OnInvalidPrinterSettings) 242 OnInvalidPrinterSettings)
244 IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewScalingDisabled, 243 IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewScalingDisabled,
245 OnPrintPreviewScalingDisabled) 244 OnPrintPreviewScalingDisabled)
246 IPC_MESSAGE_UNHANDLED(handled = false) 245 IPC_MESSAGE_UNHANDLED(handled = false)
247 IPC_END_MESSAGE_MAP() 246 IPC_END_MESSAGE_MAP()
248 return handled; 247 return handled;
249 } 248 }
250 249
251 void PrintPreviewMessageHandler::NavigateToPendingEntry(
252 const GURL& url,
253 NavigationController::ReloadType reload_type) {
254 TabContents* tab = tab_contents();
255 TabContents* preview_tab = GetPrintPreviewTab();
256 if (tab == preview_tab) {
257 // Cloud print sign-in reloads the page.
Lei Zhang 2012/08/21 18:21:23 I don't think we do this anymore. Cloud print sign
Albert Bodenhamer 2012/08/21 18:28:55 The need for this actually went away quite a while
258 DCHECK(PrintPreviewTabController::IsPrintPreviewURL(url));
259 DCHECK_EQ(NavigationController::RELOAD, reload_type);
260 return;
261 }
262 // If |tab| is navigating and it has a print preview tab, notify |tab| to
263 // consider print preview done so it unfreezes the renderer in the case of
264 // window.print().
265 if (preview_tab)
266 tab->print_view_manager()->PrintPreviewDone();
267 }
268
269 } // namespace printing 250 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_preview_message_handler.h ('k') | chrome/browser/printing/print_preview_tab_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698