| OLD | NEW |
| 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 "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| 11 #include "content/public/browser/web_contents_user_data.h" | 11 #include "content/public/browser/web_contents_user_data.h" |
| 12 #include "printing/features/features.h" |
| 12 | 13 |
| 13 class PrintPreviewUI; | 14 class PrintPreviewUI; |
| 14 struct PrintHostMsg_DidGetPreviewPageCount_Params; | 15 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
| 15 struct PrintHostMsg_DidPreviewDocument_Params; | 16 struct PrintHostMsg_DidPreviewDocument_Params; |
| 16 struct PrintHostMsg_DidPreviewPage_Params; | 17 struct PrintHostMsg_DidPreviewPage_Params; |
| 17 struct PrintHostMsg_RequestPrintPreview_Params; | 18 struct PrintHostMsg_RequestPrintPreview_Params; |
| 18 struct PrintHostMsg_SetOptionsFromDocument_Params; | 19 struct PrintHostMsg_SetOptionsFromDocument_Params; |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 class RenderFrameHost; | 22 class RenderFrameHost; |
| 22 class WebContents; | 23 class WebContents; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace gfx { | 26 namespace gfx { |
| 26 class Rect; | 27 class Rect; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace printing { | 30 namespace printing { |
| 30 | 31 |
| 31 struct PageSizeMargins; | 32 struct PageSizeMargins; |
| 32 | 33 |
| 33 // Manages the print preview handling for a WebContents. | 34 // Manages the print preview handling for a WebContents. |
| 34 class PrintPreviewMessageHandler | 35 class PrintPreviewMessageHandler |
| 35 : public content::WebContentsObserver, | 36 : public content::WebContentsObserver, |
| 36 public content::WebContentsUserData<PrintPreviewMessageHandler> { | 37 public content::WebContentsUserData<PrintPreviewMessageHandler> { |
| 37 public: | 38 public: |
| 38 ~PrintPreviewMessageHandler() override; | 39 ~PrintPreviewMessageHandler() override; |
| 39 | 40 |
| 40 // content::WebContentsObserver implementation. | 41 // content::WebContentsObserver implementation. |
| 42 #if BUILDFLAG(ENABLE_PRINT_BROWSER) |
| 43 void DidFinishLoad(content::RenderFrameHost* render_frame_host, |
| 44 const GURL& validated_url) override; |
| 45 #endif |
| 46 |
| 47 // content::WebContentsObserver implementation. |
| 41 bool OnMessageReceived(const IPC::Message& message, | 48 bool OnMessageReceived(const IPC::Message& message, |
| 42 content::RenderFrameHost* render_frame_host) override; | 49 content::RenderFrameHost* render_frame_host) override; |
| 43 | 50 |
| 44 private: | 51 private: |
| 45 explicit PrintPreviewMessageHandler(content::WebContents* web_contents); | 52 explicit PrintPreviewMessageHandler(content::WebContents* web_contents); |
| 46 friend class content::WebContentsUserData<PrintPreviewMessageHandler>; | 53 friend class content::WebContentsUserData<PrintPreviewMessageHandler>; |
| 47 | 54 |
| 48 // Gets the print preview dialog associated with the WebContents being | 55 // Gets the print preview dialog associated with the WebContents being |
| 49 // observed. | 56 // observed. |
| 50 content::WebContents* GetPrintPreviewDialog(); | 57 content::WebContents* GetPrintPreviewDialog(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 69 void OnInvalidPrinterSettings(int document_cookie); | 76 void OnInvalidPrinterSettings(int document_cookie); |
| 70 void OnSetOptionsFromDocument( | 77 void OnSetOptionsFromDocument( |
| 71 const PrintHostMsg_SetOptionsFromDocument_Params& params); | 78 const PrintHostMsg_SetOptionsFromDocument_Params& params); |
| 72 | 79 |
| 73 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler); | 80 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler); |
| 74 }; | 81 }; |
| 75 | 82 |
| 76 } // namespace printing | 83 } // namespace printing |
| 77 | 84 |
| 78 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ | 85 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ |
| OLD | NEW |