| 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_handle.h" |
| 12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 14 #include "components/prefs/pref_member.h" | 15 #include "components/prefs/pref_member.h" |
| 15 #include "components/printing/browser/print_manager.h" | 16 #include "components/printing/browser/print_manager.h" |
| 16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 19 #include "mojo/public/cpp/system/platform_handle.h" |
| 18 #include "printing/features/features.h" | 20 #include "printing/features/features.h" |
| 19 #include "printing/printed_pages_source.h" | 21 #include "printing/printed_pages_source.h" |
| 20 | 22 |
| 21 struct PrintHostMsg_DidPrintPage_Params; | 23 struct PrintHostMsg_DidPrintPage_Params; |
| 22 | 24 |
| 23 namespace content { | 25 namespace content { |
| 24 class RenderFrameHost; | 26 class RenderFrameHost; |
| 25 } | 27 } |
| 26 | 28 |
| 27 namespace printing { | 29 namespace printing { |
| 28 | 30 |
| 29 class JobEventDetails; | 31 class JobEventDetails; |
| 32 class PrintCompositeClient; |
| 30 class PrintJob; | 33 class PrintJob; |
| 31 class PrintJobWorkerOwner; | 34 class PrintJobWorkerOwner; |
| 32 class PrintQueriesQueue; | 35 class PrintQueriesQueue; |
| 33 | 36 |
| 34 // Base class for managing the print commands for a WebContents. | 37 // Base class for managing the print commands for a WebContents. |
| 35 class PrintViewManagerBase : public content::NotificationObserver, | 38 class PrintViewManagerBase : public content::NotificationObserver, |
| 36 public PrintedPagesSource, | 39 public PrintedPagesSource, |
| 37 public PrintManager { | 40 public PrintManager { |
| 38 public: | 41 public: |
| 39 ~PrintViewManagerBase() override; | 42 ~PrintViewManagerBase() override; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const content::NotificationDetails& details) override; | 75 const content::NotificationDetails& details) override; |
| 73 | 76 |
| 74 // content::WebContentsObserver implementation. | 77 // content::WebContentsObserver implementation. |
| 75 void DidStartLoading() override; | 78 void DidStartLoading() override; |
| 76 | 79 |
| 77 // Cancels the print job. | 80 // Cancels the print job. |
| 78 void NavigationStopped() override; | 81 void NavigationStopped() override; |
| 79 | 82 |
| 80 // IPC Message handlers. | 83 // IPC Message handlers. |
| 81 void OnDidGetPrintedPagesCount(int cookie, int number_pages) override; | 84 void OnDidGetPrintedPagesCount(int cookie, int number_pages) override; |
| 82 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); | |
| 83 void OnPrintingFailed(int cookie) override; | 85 void OnPrintingFailed(int cookie) override; |
| 84 void OnShowInvalidPrinterSettingsError(); | 86 void OnShowInvalidPrinterSettingsError(); |
| 87 void OnDidPrintPage(content::RenderFrameHost* render_frame_host, |
| 88 const PrintHostMsg_DidPrintPage_Params& params); |
| 89 void OnIsReadyToCompose(content::RenderFrameHost* render_frame_host, |
| 90 const PrintHostMsg_DidPrintPage_Params& params, |
| 91 bool status); |
| 92 |
| 93 // IPC message handlers for service. |
| 94 void OnComposePdfDone(mojo::ScopedSharedBufferHandle handle); |
| 85 | 95 |
| 86 // Processes a NOTIFY_PRINT_JOB_EVENT notification. | 96 // Processes a NOTIFY_PRINT_JOB_EVENT notification. |
| 87 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); | 97 void OnNotifyPrintJobEvent(const JobEventDetails& event_details); |
| 88 | 98 |
| 89 // Requests the RenderView to render all the missing pages for the print job. | 99 // Requests the RenderView to render all the missing pages for the print job. |
| 90 // No-op if no print job is pending. Returns true if at least one page has | 100 // No-op if no print job is pending. Returns true if at least one page has |
| 91 // been requested to the renderer. | 101 // been requested to the renderer. |
| 92 bool RenderAllMissingPagesNow(); | 102 bool RenderAllMissingPagesNow(); |
| 93 | 103 |
| 94 // Quits the current message loop if these conditions hold true: a document is | 104 // Quits the current message loop if these conditions hold true: a document is |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 bool inside_inner_message_loop_; | 161 bool inside_inner_message_loop_; |
| 152 | 162 |
| 153 #if !defined(OS_MACOSX) | 163 #if !defined(OS_MACOSX) |
| 154 // Set to true when OnDidPrintPage() should be expecting the first page. | 164 // Set to true when OnDidPrintPage() should be expecting the first page. |
| 155 bool expecting_first_page_; | 165 bool expecting_first_page_; |
| 156 #endif | 166 #endif |
| 157 | 167 |
| 158 // Whether printing is enabled. | 168 // Whether printing is enabled. |
| 159 BooleanPrefMember printing_enabled_; | 169 BooleanPrefMember printing_enabled_; |
| 160 | 170 |
| 171 PrintCompositeClient* composite_client_; |
| 172 |
| 161 scoped_refptr<printing::PrintQueriesQueue> queue_; | 173 scoped_refptr<printing::PrintQueriesQueue> queue_; |
| 162 | 174 |
| 163 DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase); | 175 DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBase); |
| 164 }; | 176 }; |
| 165 | 177 |
| 166 } // namespace printing | 178 } // namespace printing |
| 167 | 179 |
| 168 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ | 180 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_ |
| OLD | NEW |