OLD | NEW |
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 #ifndef COMPONENTS_PRINTING_BROWSER_PRINT_MANAGER_H_ | 5 #ifndef COMPONENTS_PRINTING_BROWSER_PRINT_MANAGER_H_ |
6 #define COMPONENTS_PRINTING_BROWSER_PRINT_MANAGER_H_ | 6 #define COMPONENTS_PRINTING_BROWSER_PRINT_MANAGER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 // Gets the file descriptor into which the PDF will be written. | 34 // Gets the file descriptor into which the PDF will be written. |
35 base::FileDescriptor file_descriptor() const { return file_descriptor_; } | 35 base::FileDescriptor file_descriptor() const { return file_descriptor_; } |
36 #endif | 36 #endif |
37 | 37 |
38 protected: | 38 protected: |
39 explicit PrintManager(content::WebContents* contents); | 39 explicit PrintManager(content::WebContents* contents); |
40 | 40 |
41 // Terminates or cancels the print job if one was pending. | 41 // Terminates or cancels the print job if one was pending. |
42 void PrintingRenderFrameDeleted(); | 42 void RenderProcessGone(base::TerminationStatus status) override; |
43 | 43 |
44 // content::WebContentsObserver | 44 // content::WebContentsObserver |
45 bool OnMessageReceived(const IPC::Message& message, | 45 bool OnMessageReceived(const IPC::Message& message) override; |
46 content::RenderFrameHost* render_frame_host) override; | |
47 | 46 |
48 // IPC handlers | 47 // IPC handlers |
49 virtual void OnDidGetPrintedPagesCount(int cookie, int number_pages); | 48 virtual void OnDidGetPrintedPagesCount(int cookie, int number_pages); |
50 virtual void OnPrintingFailed(int cookie); | 49 virtual void OnPrintingFailed(int cookie); |
51 | 50 |
52 int number_pages_; // Number of pages to print in the print job. | 51 int number_pages_; // Number of pages to print in the print job. |
53 int cookie_; // The current document cookie. | 52 int cookie_; // The current document cookie. |
54 | 53 |
55 #if defined(OS_ANDROID) | 54 #if defined(OS_ANDROID) |
56 // The file descriptor into which the PDF of the page will be written. | 55 // The file descriptor into which the PDF of the page will be written. |
57 base::FileDescriptor file_descriptor_; | 56 base::FileDescriptor file_descriptor_; |
58 | 57 |
59 // Callback to execute when done writing pdf. | 58 // Callback to execute when done writing pdf. |
60 PdfWritingDoneCallback pdf_writing_done_callback_; | 59 PdfWritingDoneCallback pdf_writing_done_callback_; |
61 #endif | 60 #endif |
62 | 61 |
63 private: | 62 private: |
64 void OnDidGetDocumentCookie(int cookie); | 63 void OnDidGetDocumentCookie(int cookie); |
65 | 64 |
66 DISALLOW_COPY_AND_ASSIGN(PrintManager); | 65 DISALLOW_COPY_AND_ASSIGN(PrintManager); |
67 }; | 66 }; |
68 | 67 |
69 } // namespace printing | 68 } // namespace printing |
70 | 69 |
71 #endif // COMPONENTS_PRINTING_BROWSER_PRINT_MANAGER_H_ | 70 #endif // COMPONENTS_PRINTING_BROWSER_PRINT_MANAGER_H_ |
OLD | NEW |