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_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 6 #define CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, | 102 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, |
103 BlockScriptInitiatedPrinting); | 103 BlockScriptInitiatedPrinting); |
104 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages); | 104 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages); |
105 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreview); | 105 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreview); |
106 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreviewCancel); | 106 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreviewCancel); |
107 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreviewFail); | 107 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, OnPrintPreviewFail); |
108 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, | 108 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, |
109 OnPrintForPrintPreview); | 109 OnPrintForPrintPreview); |
110 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, | 110 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, |
111 OnPrintForPrintPreviewFail); | 111 OnPrintForPrintPreviewFail); |
| 112 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, |
| 113 OnPrintPreviewInvalidDefaultPrinter); |
| 114 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest, |
| 115 OnPrintForPrintPreviewInvalidPrinter); |
112 | 116 |
113 #if defined(OS_WIN) || defined(OS_MACOSX) | 117 #if defined(OS_WIN) || defined(OS_MACOSX) |
114 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintLayoutTest); | 118 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintLayoutTest); |
115 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintWithIframe); | 119 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintWithIframe); |
116 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 120 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
117 | 121 |
118 // RenderViewObserver implementation. | 122 // RenderViewObserver implementation. |
119 virtual bool OnMessageReceived(const IPC::Message& message); | 123 virtual bool OnMessageReceived(const IPC::Message& message); |
120 virtual void PrintPage(WebKit::WebFrame* frame); | 124 virtual void PrintPage(WebKit::WebFrame* frame); |
121 | 125 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 FAIL_PRINT, | 164 FAIL_PRINT, |
161 FAIL_PREVIEW, | 165 FAIL_PREVIEW, |
162 }; | 166 }; |
163 | 167 |
164 // Notification when printing is done - signal tear-down/free resources. | 168 // Notification when printing is done - signal tear-down/free resources. |
165 void DidFinishPrinting(PrintingResult result); | 169 void DidFinishPrinting(PrintingResult result); |
166 | 170 |
167 // Print Settings ----------------------------------------------------------- | 171 // Print Settings ----------------------------------------------------------- |
168 | 172 |
169 // Initialize print page settings with default settings. | 173 // Initialize print page settings with default settings. |
170 bool InitPrintSettings(WebKit::WebFrame* frame, WebKit::WebNode* node); | 174 bool InitPrintSettings(WebKit::WebFrame* frame, |
| 175 WebKit::WebNode* node, |
| 176 bool is_preview); |
171 | 177 |
172 // Initialize print page settings with default settings and prepare the frame | 178 // Initialize print page settings with default settings and prepare the frame |
173 // for print. A new PrepareFrameAndViewForPrint is created to fulfill the | 179 // for print. A new PrepareFrameAndViewForPrint is created to fulfill the |
174 // request and is filled into the |prepare| argument. | 180 // request and is filled into the |prepare| argument. |
175 bool InitPrintSettingsAndPrepareFrame( | 181 bool InitPrintSettingsAndPrepareFrame( |
176 WebKit::WebFrame* frame, | 182 WebKit::WebFrame* frame, |
177 WebKit::WebNode* node, | 183 WebKit::WebNode* node, |
178 scoped_ptr<PrepareFrameAndViewForPrint>* prepare); | 184 scoped_ptr<PrepareFrameAndViewForPrint>* prepare); |
179 | 185 |
180 // Update the current print settings with new |job_settings|. |job_settings| | 186 // Update the current print settings with new |job_settings|. |job_settings| |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 402 |
397 State state_; | 403 State state_; |
398 }; | 404 }; |
399 | 405 |
400 PrintPreviewContext print_preview_context_; | 406 PrintPreviewContext print_preview_context_; |
401 | 407 |
402 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 408 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
403 }; | 409 }; |
404 | 410 |
405 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 411 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |