OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ |
6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ | 6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/shared_memory.h" |
| 13 #include "base/memory/shared_memory_handle.h" |
| 14 #include "base/memory/weak_ptr.h" |
12 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
13 #include "build/build_config.h" | 16 #include "build/build_config.h" |
14 #include "components/prefs/pref_member.h" | 17 #include "components/prefs/pref_member.h" |
15 #include "components/printing/browser/print_manager.h" | 18 #include "components/printing/browser/print_manager.h" |
| 19 #include "components/printing/service/public/interfaces/pdf_compositor.mojom.h" |
16 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
| 22 #include "mojo/public/cpp/system/platform_handle.h" |
18 #include "printing/features/features.h" | 23 #include "printing/features/features.h" |
19 #include "printing/printed_pages_source.h" | 24 #include "printing/printed_pages_source.h" |
20 | 25 |
21 struct PrintHostMsg_DidPrintPage_Params; | 26 struct PrintHostMsg_DidPrintPage_Params; |
22 | 27 |
23 namespace content { | 28 namespace content { |
24 class RenderFrameHost; | 29 class RenderFrameHost; |
25 } | 30 } |
26 | 31 |
27 namespace printing { | 32 namespace printing { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const content::NotificationDetails& details) override; | 83 const content::NotificationDetails& details) override; |
79 | 84 |
80 // content::WebContentsObserver implementation. | 85 // content::WebContentsObserver implementation. |
81 void DidStartLoading() override; | 86 void DidStartLoading() override; |
82 | 87 |
83 // Cancels the print job. | 88 // Cancels the print job. |
84 void NavigationStopped() override; | 89 void NavigationStopped() override; |
85 | 90 |
86 // IPC Message handlers. | 91 // IPC Message handlers. |
87 void OnDidGetPrintedPagesCount(int cookie, int number_pages) override; | 92 void OnDidGetPrintedPagesCount(int cookie, int number_pages) override; |
88 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); | |
89 void OnPrintingFailed(int cookie) override; | 93 void OnPrintingFailed(int cookie) override; |
90 void OnShowInvalidPrinterSettingsError(); | 94 void OnShowInvalidPrinterSettingsError(); |
| 95 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); |
| 96 |
| 97 // Handle extra tasks once a page or doc is printed. |
| 98 void UpdateForPrintedPage(const PrintHostMsg_DidPrintPage_Params& params, |
| 99 bool has_valid_page_data, |
| 100 std::unique_ptr<base::SharedMemory> shared_buf); |
| 101 |
| 102 // IPC message handlers for service. |
| 103 void OnComposePdfDone(const PrintHostMsg_DidPrintPage_Params& params, |
| 104 mojom::PdfCompositor::Status status, |
| 105 mojo::ScopedSharedBufferHandle handle); |
91 | 106 |
92 // Processes a NOTIFY_PRINT_JOB_EVENT notification. | 107 // Processes a NOTIFY_PRINT_JOB_EVENT notification. |
93 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); | 108 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); |
94 | 109 |
95 // Requests the RenderView to render all the missing pages for the print job. | 110 // Requests the RenderView to render all the missing pages for the print job. |
96 // No-op if no print job is pending. Returns true if at least one page has | 111 // No-op if no print job is pending. Returns true if at least one page has |
97 // been requested to the renderer. | 112 // been requested to the renderer. |
98 bool RenderAllMissingPagesNow(); | 113 bool RenderAllMissingPagesNow(); |
99 | 114 |
100 // Quits the current message loop if these conditions hold true: a document is | 115 // Quits the current message loop if these conditions hold true: a document is |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 #if !defined(OS_MACOSX) | 174 #if !defined(OS_MACOSX) |
160 // Set to true when OnDidPrintPage() should be expecting the first page. | 175 // Set to true when OnDidPrintPage() should be expecting the first page. |
161 bool expecting_first_page_; | 176 bool expecting_first_page_; |
162 #endif | 177 #endif |
163 | 178 |
164 // Whether printing is enabled. | 179 // Whether printing is enabled. |
165 BooleanPrefMember printing_enabled_; | 180 BooleanPrefMember printing_enabled_; |
166 | 181 |
167 scoped_refptr<printing::PrintQueriesQueue> queue_; | 182 scoped_refptr<printing::PrintQueriesQueue> queue_; |
168 | 183 |
| 184 base::WeakPtrFactory<PrintViewManagerBase> weak_ptr_factory_; |
| 185 |
169 DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase); | 186 DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase); |
170 }; | 187 }; |
171 | 188 |
172 } // namespace printing | 189 } // namespace printing |
173 | 190 |
174 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ | 191 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ |
OLD | NEW |