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

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

Issue 10535045: TabContentsWrapper -> TabContents, for printing code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
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 #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 TabContents; 13 class TabContents;
14 typedef TabContents TabContentsWrapper;
15 struct PrintHostMsg_DidGetPreviewPageCount_Params; 14 struct PrintHostMsg_DidGetPreviewPageCount_Params;
16 struct PrintHostMsg_DidPreviewDocument_Params; 15 struct PrintHostMsg_DidPreviewDocument_Params;
17 struct PrintHostMsg_DidPreviewPage_Params; 16 struct PrintHostMsg_DidPreviewPage_Params;
18 17
19 namespace gfx { 18 namespace gfx {
20 class Rect; 19 class Rect;
21 } 20 }
22 21
23 namespace printing { 22 namespace printing {
24 23
25 struct PageSizeMargins; 24 struct PageSizeMargins;
26 25
27 // TabContentsWrapper offloads print preview message handling to 26 // TabContents offloads print preview message handling to
28 // PrintPreviewMessageHandler. This object has the same life time as the 27 // PrintPreviewMessageHandler. This object has the same life time as the
29 // TabContentsWrapper that owns it. 28 // TabContents that owns it.
30 class PrintPreviewMessageHandler : public content::WebContentsObserver { 29 class PrintPreviewMessageHandler : public content::WebContentsObserver {
31 public: 30 public:
32 explicit PrintPreviewMessageHandler(content::WebContents* web_contents); 31 explicit PrintPreviewMessageHandler(content::WebContents* web_contents);
33 virtual ~PrintPreviewMessageHandler(); 32 virtual ~PrintPreviewMessageHandler();
34 33
35 // content::WebContentsObserver implementation. 34 // content::WebContentsObserver implementation.
36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
37 virtual void NavigateToPendingEntry(const GURL& url, 36 virtual void NavigateToPendingEntry(const GURL& url,
38 content::NavigationController::ReloadType reload_type) OVERRIDE; 37 content::NavigationController::ReloadType reload_type) OVERRIDE;
39 38
40 private: 39 private:
41 // Gets the print preview tab associated with the WebContents being observed. 40 // Gets the print preview tab associated with the WebContents being observed.
42 TabContentsWrapper* GetPrintPreviewTab(); 41 TabContents* GetPrintPreviewTab();
43 42
44 // Helper function to return the TabContentsWrapper for web_contents(). 43 // Helper function to return the TabContents for web_contents().
45 TabContentsWrapper* tab_contents_wrapper(); 44 TabContents* tab_contents();
46 45
47 // Gets the PrintPreviewUI associated with the WebContents being observed. 46 // Gets the PrintPreviewUI associated with the WebContents being observed.
48 PrintPreviewUI* GetPrintPreviewUI(); 47 PrintPreviewUI* GetPrintPreviewUI();
49 48
50 // Message handlers. 49 // Message handlers.
51 void OnRequestPrintPreview(bool source_is_modifiable, bool webnode_only); 50 void OnRequestPrintPreview(bool source_is_modifiable, bool webnode_only);
52 void OnDidGetDefaultPageLayout( 51 void OnDidGetDefaultPageLayout(
53 const printing::PageSizeMargins& page_layout_in_points, 52 const printing::PageSizeMargins& page_layout_in_points,
54 const gfx::Rect& printable_area_in_points, 53 const gfx::Rect& printable_area_in_points,
55 bool has_custom_page_size_style); 54 bool has_custom_page_size_style);
56 void OnDidGetPreviewPageCount( 55 void OnDidGetPreviewPageCount(
57 const PrintHostMsg_DidGetPreviewPageCount_Params& params); 56 const PrintHostMsg_DidGetPreviewPageCount_Params& params);
58 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); 57 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params);
59 void OnMetafileReadyForPrinting( 58 void OnMetafileReadyForPrinting(
60 const PrintHostMsg_DidPreviewDocument_Params& params); 59 const PrintHostMsg_DidPreviewDocument_Params& params);
61 void OnPrintPreviewFailed(int document_cookie); 60 void OnPrintPreviewFailed(int document_cookie);
62 void OnPrintPreviewCancelled(int document_cookie); 61 void OnPrintPreviewCancelled(int document_cookie);
63 void OnInvalidPrinterSettings(int document_cookie); 62 void OnInvalidPrinterSettings(int document_cookie);
64 void OnPrintPreviewScalingDisabled(); 63 void OnPrintPreviewScalingDisabled();
65 64
66 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler); 65 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler);
67 }; 66 };
68 67
69 } // namespace printing 68 } // namespace printing
70 69
71 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ 70 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698