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

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

Issue 8515017: Print Preview: Properly handle window.print(). (Closed)
Patch Set: fail instead of crash when 2 views both do window.print() Created 9 years 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
« no previous file with comments | « no previous file | chrome/browser/printing/print_preview_tab_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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/printer_query.h" 17 #include "chrome/browser/printing/printer_query.h"
17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
18 #include "chrome/browser/ui/webui/print_preview_ui.h" 19 #include "chrome/browser/ui/webui/print_preview_ui.h"
19 #include "chrome/common/print_messages.h" 20 #include "chrome/common/print_messages.h"
20 #include "content/browser/renderer_host/render_view_host.h" 21 #include "content/browser/renderer_host/render_view_host.h"
21 #include "content/browser/tab_contents/tab_contents.h" 22 #include "content/browser/tab_contents/tab_contents.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
23 #include "printing/page_size_margins.h" 24 #include "printing/page_size_margins.h"
24 #include "printing/print_job_constants.h" 25 #include "printing/print_job_constants.h"
25 26
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 const GURL& url, 252 const GURL& url,
252 NavigationController::ReloadType reload_type) { 253 NavigationController::ReloadType reload_type) {
253 TabContentsWrapper* tab = tab_contents_wrapper(); 254 TabContentsWrapper* tab = tab_contents_wrapper();
254 TabContentsWrapper* preview_tab = GetPrintPreviewTab(); 255 TabContentsWrapper* preview_tab = GetPrintPreviewTab();
255 if (tab == preview_tab) { 256 if (tab == preview_tab) {
256 // Cloud print sign-in reloads the page. 257 // Cloud print sign-in reloads the page.
257 DCHECK(PrintPreviewTabController::IsPrintPreviewURL(url)); 258 DCHECK(PrintPreviewTabController::IsPrintPreviewURL(url));
258 DCHECK_EQ(NavigationController::RELOAD, reload_type); 259 DCHECK_EQ(NavigationController::RELOAD, reload_type);
259 return; 260 return;
260 } 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();
261 } 267 }
262 268
263 } // namespace printing 269 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/printing/print_preview_tab_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698