| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/memory/shared_memory_handle.h" |
| 6 #include "base/sequenced_task_runner.h" |
| 7 #include "content/public/browser/notification_observer.h" |
| 8 #include "content/public/browser/notification_registrar.h" |
| 9 #include "content/public/browser/web_contents_observer.h" |
| 10 #include "content/public/browser/web_contents_user_data.h" |
| 11 #include "services/pdf_compositor/public/cpp/pdf_compositor_client.h" |
| 12 |
| 13 #ifndef CHROME_BROWSER_PRINTING_PRINT_COMPOSITE_CLIENT_H_ |
| 14 #define CHROME_BROWSER_PRINTING_PRINT_COMPOSITE_CLIENT_H_ |
| 15 |
| 16 namespace printing { |
| 17 |
| 18 class PrintCompositeClient |
| 19 : public pdf_compositor::PdfCompositorClient, |
| 20 public content::NotificationObserver, |
| 21 public content::WebContentsObserver, |
| 22 public content::WebContentsUserData<PrintCompositeClient> { |
| 23 public: |
| 24 explicit PrintCompositeClient(content::WebContents* web_contents); |
| 25 ~PrintCompositeClient() override; |
| 26 |
| 27 void DoComposite( |
| 28 int page_num, |
| 29 base::SharedMemoryHandle handle, |
| 30 uint32_t data_size, |
| 31 const pdf_compositor::mojom::PdfCompositor::CompositePdfCallback& |
| 32 callback, |
| 33 scoped_refptr<base::SequencedTaskRunner> callback_task_runner); |
| 34 |
| 35 private: |
| 36 // content::NotificationObserver implementation. |
| 37 void Observe(int type, |
| 38 const content::NotificationSource& source, |
| 39 const content::NotificationDetails& details) override; |
| 40 |
| 41 void OnIsReadyToComposite( |
| 42 int page_num, |
| 43 base::SharedMemoryHandle handle, |
| 44 uint32_t data_size, |
| 45 const pdf_compositor::mojom::PdfCompositor::CompositePdfCallback& |
| 46 callback, |
| 47 scoped_refptr<base::SequencedTaskRunner> callback_task_runner, |
| 48 bool status); |
| 49 |
| 50 content::NotificationRegistrar registrar_; |
| 51 |
| 52 base::WeakPtrFactory<PrintCompositeClient> weak_factory_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(PrintCompositeClient); |
| 55 }; |
| 56 |
| 57 } // namespace printing |
| 58 |
| 59 #endif // CHROME_BROWSER_PRINTING_PRINT_COMPOSITE_CLIENT_H_ |
| OLD | NEW |