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 #ifndef COMPONENTS_PRINTING_BROWSER_PRINT_COMPOSITE_CLIENT_H_ |
| 6 #define COMPONENTS_PRINTING_BROWSER_PRINT_COMPOSITE_CLIENT_H_ |
| 7 |
| 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/memory/shared_memory_handle.h" |
| 11 #include "components/printing/service/public/cpp/pdf_compositor_client.h" |
| 12 #include "content/public/browser/web_contents_observer.h" |
| 13 #include "content/public/browser/web_contents_user_data.h" |
| 14 |
| 15 namespace printing { |
| 16 |
| 17 class PrintCompositeClient |
| 18 : public PdfCompositorClient, |
| 19 public content::WebContentsUserData<PrintCompositeClient> { |
| 20 public: |
| 21 explicit PrintCompositeClient(content::WebContents* web_contents); |
| 22 ~PrintCompositeClient() override; |
| 23 |
| 24 void DoComposite(base::SharedMemoryHandle handle, |
| 25 uint32_t data_size, |
| 26 mojom::PdfCompositor::CompositePdfCallback callback); |
| 27 |
| 28 // Utility functions. |
| 29 static std::unique_ptr<base::SharedMemory> GetShmFromMojoHandle( |
| 30 mojo::ScopedSharedBufferHandle handle); |
| 31 static scoped_refptr<base::RefCountedBytes> GetDataFromMojoHandle( |
| 32 mojo::ScopedSharedBufferHandle handle); |
| 33 |
| 34 private: |
| 35 void CreateConnectorRequest(); |
| 36 |
| 37 service_manager::mojom::ConnectorRequest connector_request_; |
| 38 std::unique_ptr<service_manager::Connector> connector_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(PrintCompositeClient); |
| 41 }; |
| 42 |
| 43 } // namespace printing |
| 44 |
| 45 #endif // COMPONENTS_PRINTING_BROWSER_PRINT_COMPOSITE_CLIENT_H_ |
OLD | NEW |