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

Side by Side Diff: components/printing/browser/print_manager.cc

Issue 2510753002: Revert of Make printing work better with OOPIF. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/printing/browser/print_manager.h" 5 #include "components/printing/browser/print_manager.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "components/printing/common/print_messages.h" 8 #include "components/printing/common/print_messages.h"
9 9
10 namespace printing { 10 namespace printing {
11 11
12 PrintManager::PrintManager(content::WebContents* contents) 12 PrintManager::PrintManager(content::WebContents* contents)
13 : content::WebContentsObserver(contents), 13 : content::WebContentsObserver(contents),
14 number_pages_(0), 14 number_pages_(0),
15 cookie_(0) { 15 cookie_(0) {
16 } 16 }
17 17
18 PrintManager::~PrintManager() { 18 PrintManager::~PrintManager() {
19 } 19 }
20 20
21 bool PrintManager::OnMessageReceived( 21 bool PrintManager::OnMessageReceived(const IPC::Message& message) {
22 const IPC::Message& message,
23 content::RenderFrameHost* render_frame_host) {
24 bool handled = true; 22 bool handled = true;
25 IPC_BEGIN_MESSAGE_MAP(PrintManager, message) 23 IPC_BEGIN_MESSAGE_MAP(PrintManager, message)
26 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, 24 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount,
27 OnDidGetPrintedPagesCount) 25 OnDidGetPrintedPagesCount)
28 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetDocumentCookie, 26 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetDocumentCookie,
29 OnDidGetDocumentCookie) 27 OnDidGetDocumentCookie)
30 IPC_MESSAGE_HANDLER(PrintHostMsg_PrintingFailed, OnPrintingFailed) 28 IPC_MESSAGE_HANDLER(PrintHostMsg_PrintingFailed, OnPrintingFailed)
31 IPC_MESSAGE_UNHANDLED(handled = false) 29 IPC_MESSAGE_UNHANDLED(handled = false)
32 IPC_END_MESSAGE_MAP() 30 IPC_END_MESSAGE_MAP()
33 return handled; 31 return handled;
(...skipping 13 matching lines...) Expand all
47 void PrintManager::OnPrintingFailed(int cookie) { 45 void PrintManager::OnPrintingFailed(int cookie) {
48 if (cookie != cookie_) { 46 if (cookie != cookie_) {
49 NOTREACHED(); 47 NOTREACHED();
50 return; 48 return;
51 } 49 }
52 #if defined(OS_ANDROID) 50 #if defined(OS_ANDROID)
53 PdfWritingDone(false); 51 PdfWritingDone(false);
54 #endif 52 #endif
55 } 53 }
56 54
57 void PrintManager::PrintingRenderFrameDeleted() { 55 void PrintManager::RenderProcessGone(base::TerminationStatus status) {
58 #if defined(OS_ANDROID) 56 #if defined(OS_ANDROID)
59 PdfWritingDone(false); 57 PdfWritingDone(false);
60 #endif 58 #endif
61 } 59 }
62 60
63 #if defined(OS_ANDROID) 61 #if defined(OS_ANDROID)
64 void PrintManager::PdfWritingDone(bool result) { 62 void PrintManager::PdfWritingDone(bool result) {
65 if (!pdf_writing_done_callback_.is_null()) 63 if (!pdf_writing_done_callback_.is_null())
66 pdf_writing_done_callback_.Run(file_descriptor().fd, result); 64 pdf_writing_done_callback_.Run(file_descriptor().fd, result);
67 // Invalidate the file descriptor so it doesn't get reused. 65 // Invalidate the file descriptor so it doesn't get reused.
68 file_descriptor_ = base::FileDescriptor(-1, false); 66 file_descriptor_ = base::FileDescriptor(-1, false);
69 } 67 }
70 #endif 68 #endif
71 69
72 } // namespace printing 70 } // namespace printing
OLDNEW
« no previous file with comments | « components/printing/browser/print_manager.h ('k') | components/printing/common/print_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698