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 "base/sequenced_task_runner.h" | |
Lei Zhang
2017/08/31 22:35:03
No longer needed in the header -> move to .cc file
Wei Li
2017/09/01 19:52:14
Removed it.
| |
12 #include "components/printing/service/public/cpp/pdf_compositor_client.h" | |
13 #include "content/public/browser/web_contents_observer.h" | |
14 #include "content/public/browser/web_contents_user_data.h" | |
15 | |
16 namespace printing { | |
17 | |
18 class PrintCompositeClient | |
19 : public PdfCompositorClient, | |
20 public content::WebContentsObserver, | |
21 public content::WebContentsUserData<PrintCompositeClient> { | |
22 public: | |
23 explicit PrintCompositeClient(content::WebContents* web_contents); | |
24 ~PrintCompositeClient() override; | |
25 | |
26 void CreateConnectorRequest(); | |
27 void DoComposite(base::SharedMemoryHandle handle, | |
28 uint32_t data_size, | |
29 mojom::PdfCompositor::CompositePdfCallback callback); | |
30 | |
31 // Utility functions. | |
32 static std::unique_ptr<base::SharedMemory> GetShmFromMojoHandle( | |
33 mojo::ScopedSharedBufferHandle handle); | |
34 static scoped_refptr<base::RefCountedBytes> GetDataFromMojoHandle( | |
35 mojo::ScopedSharedBufferHandle handle); | |
36 | |
37 private: | |
38 service_manager::mojom::ConnectorRequest connector_request_; | |
39 std::unique_ptr<service_manager::Connector> connector_; | |
40 base::WeakPtrFactory<PrintCompositeClient> weak_factory_; | |
41 | |
42 DISALLOW_COPY_AND_ASSIGN(PrintCompositeClient); | |
43 }; | |
44 | |
45 } // namespace printing | |
46 | |
47 #endif // COMPONENTS_PRINTING_BROWSER_PRINT_COMPOSITE_CLIENT_H_ | |
OLD | NEW |