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 "content/browser/tab_contents/tab_contents_observer.h" | 9 #include "content/browser/tab_contents/tab_contents_observer.h" |
10 | 10 |
| 11 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
11 struct PrintHostMsg_DidPreviewDocument_Params; | 12 struct PrintHostMsg_DidPreviewDocument_Params; |
12 struct PrintHostMsg_DidPreviewPage_Params; | 13 struct PrintHostMsg_DidPreviewPage_Params; |
13 | 14 |
14 namespace printing { | 15 namespace printing { |
15 | 16 |
16 // TabContents offloads print preview message handling to | 17 // TabContents offloads print preview message handling to |
17 // PrintPreviewMessageHandler. This object has the same life time as the | 18 // PrintPreviewMessageHandler. This object has the same life time as the |
18 // TabContents that owns it. | 19 // TabContents that owns it. |
19 class PrintPreviewMessageHandler : public TabContentsObserver { | 20 class PrintPreviewMessageHandler : public TabContentsObserver { |
20 public: | 21 public: |
21 explicit PrintPreviewMessageHandler(TabContents* tab_contents); | 22 explicit PrintPreviewMessageHandler(TabContents* tab_contents); |
22 virtual ~PrintPreviewMessageHandler(); | 23 virtual ~PrintPreviewMessageHandler(); |
23 | 24 |
24 // TabContentsObserver implementation. | 25 // TabContentsObserver implementation. |
25 virtual bool OnMessageReceived(const IPC::Message& message); | 26 virtual bool OnMessageReceived(const IPC::Message& message); |
26 virtual void DidStartLoading(); | 27 virtual void DidStartLoading(); |
27 | 28 |
28 private: | 29 private: |
29 // Gets the print preview tab associated with |owner_|. | 30 // Gets the print preview tab associated with |owner_|. |
30 TabContents* GetPrintPreviewTab(); | 31 TabContents* GetPrintPreviewTab(); |
31 | 32 |
32 // Message handlers. | 33 // Message handlers. |
33 void OnRequestPrintPreview(); | 34 void OnRequestPrintPreview(); |
34 void OnDidGetPreviewPageCount(int document_cookie, | 35 void OnDidGetPreviewPageCount( |
35 int page_count, | 36 const PrintHostMsg_DidGetPreviewPageCount_Params& params); |
36 bool is_modifiable); | |
37 // |page_number| is 0-based. | 37 // |page_number| is 0-based. |
38 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); | 38 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); |
39 void OnPagesReadyForPreview( | 39 void OnPagesReadyForPreview( |
40 const PrintHostMsg_DidPreviewDocument_Params& params); | 40 const PrintHostMsg_DidPreviewDocument_Params& params); |
41 void OnPrintPreviewFailed(int document_cookie); | 41 void OnPrintPreviewFailed(int document_cookie); |
42 | 42 |
43 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler); | 43 DISALLOW_COPY_AND_ASSIGN(PrintPreviewMessageHandler); |
44 }; | 44 }; |
45 | 45 |
46 } // namespace printing | 46 } // namespace printing |
47 | 47 |
48 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ | 48 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ |
OLD | NEW |