| OLD | NEW |
| 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_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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 // Print / preview the node under the context menu. | 177 // Print / preview the node under the context menu. |
| 178 void OnPrintNodeUnderContextMenu(); | 178 void OnPrintNodeUnderContextMenu(); |
| 179 | 179 |
| 180 // Print the pages for print preview. Do not display the native print dialog | 180 // Print the pages for print preview. Do not display the native print dialog |
| 181 // for user settings. |job_settings| has new print job settings values. | 181 // for user settings. |job_settings| has new print job settings values. |
| 182 void OnPrintForPrintPreview(const base::DictionaryValue& job_settings); | 182 void OnPrintForPrintPreview(const base::DictionaryValue& job_settings); |
| 183 | 183 |
| 184 void OnPrintingDone(bool success); | 184 void OnPrintingDone(bool success); |
| 185 | 185 |
| 186 void SetScriptedPrintBlocked(bool blocked); |
| 187 |
| 186 // Main printing code ------------------------------------------------------- | 188 // Main printing code ------------------------------------------------------- |
| 187 | 189 |
| 188 void Print(WebKit::WebFrame* frame, const WebKit::WebNode& node); | 190 void Print(WebKit::WebFrame* frame, const WebKit::WebNode& node); |
| 189 | 191 |
| 190 // Notification when printing is done - signal tear-down/free resources. | 192 // Notification when printing is done - signal tear-down/free resources. |
| 191 void DidFinishPrinting(PrintingResult result); | 193 void DidFinishPrinting(PrintingResult result); |
| 192 | 194 |
| 193 // Print Settings ----------------------------------------------------------- | 195 // Print Settings ----------------------------------------------------------- |
| 194 | 196 |
| 195 // Initialize print page settings with default settings. | 197 // Initialize print page settings with default settings. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 const printing::PageSizeMargins& page_layout_in_points, | 307 const printing::PageSizeMargins& page_layout_in_points, |
| 306 const base::DictionaryValue& header_footer_info); | 308 const base::DictionaryValue& header_footer_info); |
| 307 | 309 |
| 308 bool GetPrintFrame(WebKit::WebFrame** frame); | 310 bool GetPrintFrame(WebKit::WebFrame** frame); |
| 309 | 311 |
| 310 // This reports the current time - |start_time| as the time to render a page. | 312 // This reports the current time - |start_time| as the time to render a page. |
| 311 void ReportPreviewPageRenderTime(base::TimeTicks start_time); | 313 void ReportPreviewPageRenderTime(base::TimeTicks start_time); |
| 312 | 314 |
| 313 // Script Initiated Printing ------------------------------------------------ | 315 // Script Initiated Printing ------------------------------------------------ |
| 314 | 316 |
| 317 // Return true if script initiated printing is currently allowed. |
| 318 bool IsScriptInitiatedPrintAllowed(WebKit::WebFrame* frame); |
| 319 |
| 315 // Returns true if script initiated printing occurs too often. | 320 // Returns true if script initiated printing occurs too often. |
| 316 bool IsScriptInitiatedPrintTooFrequent(WebKit::WebFrame* frame); | 321 bool IsScriptInitiatedPrintTooFrequent(WebKit::WebFrame* frame); |
| 317 | 322 |
| 318 // Reset the counter for script initiated printing. | 323 // Reset the counter for script initiated printing. |
| 319 // Scripted printing will be allowed to continue. | 324 // Scripted printing will be allowed to continue. |
| 320 void ResetScriptedPrintCount(); | 325 void ResetScriptedPrintCount(); |
| 321 | 326 |
| 322 // Increment the counter for script initiated printing. | 327 // Increment the counter for script initiated printing. |
| 323 // Scripted printing will be blocked for a limited amount of time. | 328 // Scripted printing will be blocked for a limited amount of time. |
| 324 void IncrementScriptedPrintCount(); | 329 void IncrementScriptedPrintCount(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 347 bool is_print_ready_metafile_sent_; | 352 bool is_print_ready_metafile_sent_; |
| 348 bool ignore_css_margins_; | 353 bool ignore_css_margins_; |
| 349 | 354 |
| 350 // True if we need to auto fit to page else false. | 355 // True if we need to auto fit to page else false. |
| 351 // NOTE: When we print to pdf, we don't fit to page. | 356 // NOTE: When we print to pdf, we don't fit to page. |
| 352 bool fit_to_page_; | 357 bool fit_to_page_; |
| 353 | 358 |
| 354 // Used for scripted initiated printing blocking. | 359 // Used for scripted initiated printing blocking. |
| 355 base::Time last_cancelled_script_print_; | 360 base::Time last_cancelled_script_print_; |
| 356 int user_cancelled_scripted_print_count_; | 361 int user_cancelled_scripted_print_count_; |
| 362 bool is_scripted_printing_blocked_; |
| 357 | 363 |
| 358 // Let the browser process know of a printing failure. Only set to false when | 364 // Let the browser process know of a printing failure. Only set to false when |
| 359 // the failure came from the browser in the first place. | 365 // the failure came from the browser in the first place. |
| 360 bool notify_browser_of_print_failure_; | 366 bool notify_browser_of_print_failure_; |
| 361 | 367 |
| 362 scoped_ptr<PrintMsg_PrintPages_Params> old_print_pages_params_; | 368 scoped_ptr<PrintMsg_PrintPages_Params> old_print_pages_params_; |
| 363 | 369 |
| 364 // Strings generated by the browser process to be printed as headers and | 370 // Strings generated by the browser process to be printed as headers and |
| 365 // footers if requested by the user. | 371 // footers if requested by the user. |
| 366 scoped_ptr<base::DictionaryValue> header_footer_info_; | 372 scoped_ptr<base::DictionaryValue> header_footer_info_; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 469 |
| 464 State state_; | 470 State state_; |
| 465 }; | 471 }; |
| 466 | 472 |
| 467 PrintPreviewContext print_preview_context_; | 473 PrintPreviewContext print_preview_context_; |
| 468 | 474 |
| 469 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 475 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 470 }; | 476 }; |
| 471 | 477 |
| 472 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 478 #endif // CHROME_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |