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