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 OnPrintPreviewInvalidSettingsFail); |
112 | 114 |
113 #if defined(OS_WIN) || defined(OS_MACOSX) | 115 #if defined(OS_WIN) || defined(OS_MACOSX) |
114 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintLayoutTest); | 116 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintLayoutTest); |
115 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintWithIframe); | 117 FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintWithIframe); |
116 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 118 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
117 | 119 |
118 // RenderViewObserver implementation. | 120 // RenderViewObserver implementation. |
119 virtual bool OnMessageReceived(const IPC::Message& message); | 121 virtual bool OnMessageReceived(const IPC::Message& message); |
120 virtual void PrintPage(WebKit::WebFrame* frame); | 122 virtual void PrintPage(WebKit::WebFrame* frame); |
121 | 123 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 FAIL_PRINT, | 162 FAIL_PRINT, |
161 FAIL_PREVIEW, | 163 FAIL_PREVIEW, |
162 }; | 164 }; |
163 | 165 |
164 // Notification when printing is done - signal tear-down/free resources. | 166 // Notification when printing is done - signal tear-down/free resources. |
165 void DidFinishPrinting(PrintingResult result); | 167 void DidFinishPrinting(PrintingResult result); |
166 | 168 |
167 // Print Settings ----------------------------------------------------------- | 169 // Print Settings ----------------------------------------------------------- |
168 | 170 |
169 // Initialize print page settings with default settings. | 171 // Initialize print page settings with default settings. |
170 bool InitPrintSettings(WebKit::WebFrame* frame, WebKit::WebNode* node); | 172 bool InitPrintSettings(WebKit::WebFrame* frame, |
| 173 WebKit::WebNode* node, |
| 174 bool is_preview); |
171 | 175 |
172 // Initialize print page settings with default settings and prepare the frame | 176 // Initialize print page settings with default settings and prepare the frame |
173 // for print. A new PrepareFrameAndViewForPrint is created to fulfill the | 177 // for print. A new PrepareFrameAndViewForPrint is created to fulfill the |
174 // request and is filled into the |prepare| argument. | 178 // request and is filled into the |prepare| argument. |
175 bool InitPrintSettingsAndPrepareFrame( | 179 bool InitPrintSettingsAndPrepareFrame( |
176 WebKit::WebFrame* frame, | 180 WebKit::WebFrame* frame, |
177 WebKit::WebNode* node, | 181 WebKit::WebNode* node, |
178 scoped_ptr<PrepareFrameAndViewForPrint>* prepare); | 182 scoped_ptr<PrepareFrameAndViewForPrint>* prepare); |
179 | 183 |
180 // Update the current print settings with new |job_settings|. |job_settings| | 184 // 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 | 400 |
397 State state_; | 401 State state_; |
398 }; | 402 }; |
399 | 403 |
400 PrintPreviewContext print_preview_context_; | 404 PrintPreviewContext print_preview_context_; |
401 | 405 |
402 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 406 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
403 }; | 407 }; |
404 | 408 |
405 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 409 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
OLD | NEW |