| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| 11 | 11 |
| 12 class PrintPreviewUI; | 12 class PrintPreviewUI; |
| 13 class TabContentsWrapper; | 13 class TabContentsWrapper; |
| 14 struct PrintHostMsg_DidGetPreviewPageCount_Params; | 14 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
| 15 struct PrintHostMsg_DidPreviewDocument_Params; | 15 struct PrintHostMsg_DidPreviewDocument_Params; |
| 16 struct PrintHostMsg_DidPreviewPage_Params; | 16 struct PrintHostMsg_DidPreviewPage_Params; |
| 17 | 17 |
| 18 namespace gfx { |
| 19 class Rect; |
| 20 } |
| 21 |
| 18 namespace printing { | 22 namespace printing { |
| 19 | 23 |
| 20 struct PageSizeMargins; | 24 struct PageSizeMargins; |
| 21 | 25 |
| 22 // TabContents offloads print preview message handling to | 26 // TabContents offloads print preview message handling to |
| 23 // PrintPreviewMessageHandler. This object has the same life time as the | 27 // PrintPreviewMessageHandler. This object has the same life time as the |
| 24 // TabContents that owns it. | 28 // TabContents that owns it. |
| 25 class PrintPreviewMessageHandler : public content::WebContentsObserver { | 29 class PrintPreviewMessageHandler : public content::WebContentsObserver { |
| 26 public: | 30 public: |
| 27 explicit PrintPreviewMessageHandler(content::WebContents* web_contents); | 31 explicit PrintPreviewMessageHandler(content::WebContents* web_contents); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 // Helper function to return the TabContentsWrapper for web_contents(). | 43 // Helper function to return the TabContentsWrapper for web_contents(). |
| 40 TabContentsWrapper* tab_contents_wrapper(); | 44 TabContentsWrapper* tab_contents_wrapper(); |
| 41 | 45 |
| 42 // Gets the PrintPreviewUI associated with the WebContents being observed. | 46 // Gets the PrintPreviewUI associated with the WebContents being observed. |
| 43 PrintPreviewUI* GetPrintPreviewUI(); | 47 PrintPreviewUI* GetPrintPreviewUI(); |
| 44 | 48 |
| 45 // Message handlers. | 49 // Message handlers. |
| 46 void OnRequestPrintPreview(bool source_is_modifiable, bool webnode_only); | 50 void OnRequestPrintPreview(bool source_is_modifiable, bool webnode_only); |
| 47 void OnDidGetDefaultPageLayout( | 51 void OnDidGetDefaultPageLayout( |
| 48 const printing::PageSizeMargins& page_layout_in_points, | 52 const printing::PageSizeMargins& page_layout_in_points, |
| 53 const gfx::Rect& printable_area_in_points, |
| 49 bool has_custom_page_size_style); | 54 bool has_custom_page_size_style); |
| 50 void OnDidGetPreviewPageCount( | 55 void OnDidGetPreviewPageCount( |
| 51 const PrintHostMsg_DidGetPreviewPageCount_Params& params); | 56 const PrintHostMsg_DidGetPreviewPageCount_Params& params); |
| 52 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); | 57 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); |
| 53 void OnMetafileReadyForPrinting( | 58 void OnMetafileReadyForPrinting( |
| 54 const PrintHostMsg_DidPreviewDocument_Params& params); | 59 const PrintHostMsg_DidPreviewDocument_Params& params); |
| 55 void OnPrintPreviewFailed(int document_cookie); | 60 void OnPrintPreviewFailed(int document_cookie); |
| 56 void OnPrintPreviewCancelled(int document_cookie); | 61 void OnPrintPreviewCancelled(int document_cookie); |
| 57 void OnInvalidPrinterSettings(int document_cookie); | 62 void OnInvalidPrinterSettings(int document_cookie); |
| 58 | 63 |
| 59 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler); | 64 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler); |
| 60 }; | 65 }; |
| 61 | 66 |
| 62 } // namespace printing | 67 } // namespace printing |
| 63 | 68 |
| 64 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ | 69 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ |
| OLD | NEW |