OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/tab_contents/tab_contents_observer.h" | 9 #include "content/browser/tab_contents/tab_contents_observer.h" |
10 | 10 |
11 struct ViewHostMsg_DidPreviewDocument_Params; | 11 struct ViewHostMsg_DidPreviewDocument_Params; |
12 | 12 |
13 namespace printing { | 13 namespace printing { |
14 | 14 |
15 // TabContents offloads print preview message handling to | 15 // TabContents offloads print preview message handling to |
16 // PrintPreviewMessageHandler. This object has the same life time as the | 16 // PrintPreviewMessageHandler. This object has the same life time as the |
17 // TabContents that owns it. | 17 // TabContents that owns it. |
18 class PrintPreviewMessageHandler : public TabContentsObserver { | 18 class PrintPreviewMessageHandler : public TabContentsObserver { |
19 public: | 19 public: |
20 explicit PrintPreviewMessageHandler(TabContents* tab_contents); | 20 explicit PrintPreviewMessageHandler(TabContents* tab_contents); |
21 virtual ~PrintPreviewMessageHandler(); | 21 virtual ~PrintPreviewMessageHandler(); |
22 | 22 |
23 void OnPagesReadyForPreview( | 23 void OnPagesReadyForPreview( |
24 const ViewHostMsg_DidPreviewDocument_Params& params); | 24 const ViewHostMsg_DidPreviewDocument_Params& params); |
25 | 25 |
26 // TabContentsObserver implementation. | 26 // TabContentsObserver implementation. |
27 virtual bool OnMessageReceived(const IPC::Message& message); | 27 virtual bool OnMessageReceived(const IPC::Message& message); |
28 | 28 |
29 private: | 29 private: |
30 // Gets the print preview tab associated with |owner_|. | 30 // Gets the print preview tab associated with |owner_|. |
31 TabContents* GetPrintPreviewTab(); | 31 TabContents* GetPrintPreviewTab(); |
32 | 32 |
33 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler); | 33 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler); |
34 }; | 34 }; |
35 | 35 |
36 } // namespace printing | 36 } // namespace printing |
37 | 37 |
38 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ | 38 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ |
OLD | NEW |