Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: components/printing/browser/print_composite_client.h

Issue 2920013002: Use pdf compositor service for printing when OOPIF is enabled
Patch Set: rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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"
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(
28 base::SharedMemoryHandle handle,
29 uint32_t data_size,
30 mojom::PdfCompositor::CompositePdfCallback callback,
31 scoped_refptr<base::SequencedTaskRunner> callback_task_runner);
32
33 // Utility functions.
34 static std::unique_ptr<base::SharedMemory> GetShmFromMojoHandle(
35 mojo::ScopedSharedBufferHandle handle);
36 static scoped_refptr<base::RefCountedBytes> GetDataFromMojoHandle(
37 mojo::ScopedSharedBufferHandle handle);
38
39 private:
40 service_manager::mojom::ConnectorRequest connector_request_;
41 std::unique_ptr<service_manager::Connector> connector_;
42 base::WeakPtrFactory<PrintCompositeClient> weak_factory_;
43
44 DISALLOW_COPY_AND_ASSIGN(PrintCompositeClient);
45 };
46
47 } // namespace printing
48
49 #endif // COMPONENTS_PRINTING_BROWSER_PRINT_COMPOSITE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698