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

Side by Side Diff: chrome/browser/printing/print_preview_message_handler.h

Issue 2920013002: Use pdf compositor service for printing when OOPIF is enabled
Patch Set: rebase Created 3 years, 3 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PREVIEW_MESSAGE_HANDLER_H_ 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_
6 #define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ 6 #define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted_memory.h"
11 #include "components/printing/service/public/interfaces/pdf_compositor.mojom.h"
10 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
11 #include "content/public/browser/web_contents_user_data.h" 13 #include "content/public/browser/web_contents_user_data.h"
12 14
13 class PrintPreviewUI; 15 class PrintPreviewUI;
14 struct PrintHostMsg_DidGetPreviewPageCount_Params; 16 struct PrintHostMsg_DidGetPreviewPageCount_Params;
15 struct PrintHostMsg_DidPreviewDocument_Params; 17 struct PrintHostMsg_DidPreviewDocument_Params;
16 struct PrintHostMsg_DidPreviewPage_Params; 18 struct PrintHostMsg_DidPreviewPage_Params;
17 struct PrintHostMsg_RequestPrintPreview_Params; 19 struct PrintHostMsg_RequestPrintPreview_Params;
18 struct PrintHostMsg_SetOptionsFromDocument_Params; 20 struct PrintHostMsg_SetOptionsFromDocument_Params;
19 21
(...skipping 14 matching lines...) Expand all
34 class PrintPreviewMessageHandler 36 class PrintPreviewMessageHandler
35 : public content::WebContentsObserver, 37 : public content::WebContentsObserver,
36 public content::WebContentsUserData<PrintPreviewMessageHandler> { 38 public content::WebContentsUserData<PrintPreviewMessageHandler> {
37 public: 39 public:
38 ~PrintPreviewMessageHandler() override; 40 ~PrintPreviewMessageHandler() override;
39 41
40 // content::WebContentsObserver implementation. 42 // content::WebContentsObserver implementation.
41 bool OnMessageReceived(const IPC::Message& message, 43 bool OnMessageReceived(const IPC::Message& message,
42 content::RenderFrameHost* render_frame_host) override; 44 content::RenderFrameHost* render_frame_host) override;
43 45
46 void OnCompositePdfPageDone(int page_number,
Lei Zhang 2017/08/28 23:01:12 I think these can be private.
Wei Li 2017/08/30 00:24:02 Done.
47 int request_id,
48 mojom::PdfCompositor::Status status,
49 mojo::ScopedSharedBufferHandle handle);
50
51 void OnCompositePdfDocumentDone(int page_count,
52 int request_id,
53 mojom::PdfCompositor::Status status,
54 mojo::ScopedSharedBufferHandle handle);
55
44 private: 56 private:
45 explicit PrintPreviewMessageHandler(content::WebContents* web_contents); 57 explicit PrintPreviewMessageHandler(content::WebContents* web_contents);
46 friend class content::WebContentsUserData<PrintPreviewMessageHandler>; 58 friend class content::WebContentsUserData<PrintPreviewMessageHandler>;
47 59
48 // Gets the print preview dialog associated with the WebContents being 60 // Gets the print preview dialog associated with the WebContents being
49 // observed. 61 // observed.
50 content::WebContents* GetPrintPreviewDialog(); 62 content::WebContents* GetPrintPreviewDialog();
51 63
52 // Gets the PrintPreviewUI associated with the WebContents being observed. 64 // Gets the PrintPreviewUI associated with the WebContents being observed.
53 PrintPreviewUI* GetPrintPreviewUI(); 65 PrintPreviewUI* GetPrintPreviewUI();
54 66
55 // Message handlers. 67 // Message handlers.
56 void OnRequestPrintPreview( 68 void OnRequestPrintPreview(
57 content::RenderFrameHost* render_frame_host, 69 content::RenderFrameHost* render_frame_host,
58 const PrintHostMsg_RequestPrintPreview_Params& params); 70 const PrintHostMsg_RequestPrintPreview_Params& params);
59 void OnDidGetDefaultPageLayout(const PageSizeMargins& page_layout_in_points, 71 void OnDidGetDefaultPageLayout(const PageSizeMargins& page_layout_in_points,
60 const gfx::Rect& printable_area_in_points, 72 const gfx::Rect& printable_area_in_points,
61 bool has_custom_page_size_style); 73 bool has_custom_page_size_style);
62 void OnDidGetPreviewPageCount( 74 void OnDidGetPreviewPageCount(
63 const PrintHostMsg_DidGetPreviewPageCount_Params& params); 75 const PrintHostMsg_DidGetPreviewPageCount_Params& params);
64 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); 76 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params);
65 void OnMetafileReadyForPrinting( 77 void OnMetafileReadyForPrinting(
66 const PrintHostMsg_DidPreviewDocument_Params& params); 78 const PrintHostMsg_DidPreviewDocument_Params& params);
67 void OnPrintPreviewFailed(int document_cookie); 79 void OnPrintPreviewFailed(int document_cookie);
68 void OnPrintPreviewCancelled(int document_cookie); 80 void OnPrintPreviewCancelled(int document_cookie);
69 void OnInvalidPrinterSettings(int document_cookie); 81 void OnInvalidPrinterSettings(int document_cookie);
70 void OnSetOptionsFromDocument( 82 void OnSetOptionsFromDocument(
71 const PrintHostMsg_SetOptionsFromDocument_Params& params); 83 const PrintHostMsg_SetOptionsFromDocument_Params& params);
72 84
85 void NotifyUIPreviewPageReady(
86 int page_number,
87 int request_id,
88 scoped_refptr<base::RefCountedBytes> data_bytes);
89 void NotifyUIPreviewDocumentReady(
90 int page_count,
91 int request_id,
92 scoped_refptr<base::RefCountedBytes> data_bytes);
93
73 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler); 94 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler);
74 }; 95 };
75 96
76 } // namespace printing 97 } // namespace printing
77 98
78 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ 99 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698