| 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 COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 5 #ifndef COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 6 #define COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 6 #define COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 float webkit_scale_factor, | 345 float webkit_scale_factor, |
| 346 const PageSizeMargins& page_layout_in_points, | 346 const PageSizeMargins& page_layout_in_points, |
| 347 const PrintMsg_Print_Params& params); | 347 const PrintMsg_Print_Params& params); |
| 348 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | 348 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 349 | 349 |
| 350 // Script Initiated Printing ------------------------------------------------ | 350 // Script Initiated Printing ------------------------------------------------ |
| 351 | 351 |
| 352 // Return true if script initiated printing is currently | 352 // Return true if script initiated printing is currently |
| 353 // allowed. |user_initiated| should be true when a user event triggered the | 353 // allowed. |user_initiated| should be true when a user event triggered the |
| 354 // script, most likely by pressing a print button on the page. | 354 // script, most likely by pressing a print button on the page. |
| 355 bool IsScriptInitiatedPrintAllowed(blink::WebFrame* frame, | 355 bool IsScriptInitiatedPrintAllowed(blink::WebLocalFrame* frame, |
| 356 bool user_initiated); | 356 bool user_initiated); |
| 357 | 357 |
| 358 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 358 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 359 // Shows scripted print preview when options from plugin are available. | 359 // Shows scripted print preview when options from plugin are available. |
| 360 void ShowScriptedPrintPreview(); | 360 void ShowScriptedPrintPreview(); |
| 361 | 361 |
| 362 // WARNING: |this| may be gone after this method returns when |type| is | 362 // WARNING: |this| may be gone after this method returns when |type| is |
| 363 // PRINT_PREVIEW_SCRIPTED. | 363 // PRINT_PREVIEW_SCRIPTED. |
| 364 void RequestPrintPreview(PrintPreviewRequestType type); | 364 void RequestPrintPreview(PrintPreviewRequestType type); |
| 365 | 365 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 enum PrintPreviewErrorBuckets error_; | 503 enum PrintPreviewErrorBuckets error_; |
| 504 | 504 |
| 505 State state_; | 505 State state_; |
| 506 }; | 506 }; |
| 507 | 507 |
| 508 class ScriptingThrottler { | 508 class ScriptingThrottler { |
| 509 public: | 509 public: |
| 510 ScriptingThrottler(); | 510 ScriptingThrottler(); |
| 511 | 511 |
| 512 // Returns false if script initiated printing occurs too often. | 512 // Returns false if script initiated printing occurs too often. |
| 513 bool IsAllowed(blink::WebFrame* frame); | 513 bool IsAllowed(blink::WebLocalFrame* frame); |
| 514 | 514 |
| 515 // Reset the counter for script initiated printing. | 515 // Reset the counter for script initiated printing. |
| 516 // Scripted printing will be allowed to continue. | 516 // Scripted printing will be allowed to continue. |
| 517 void Reset(); | 517 void Reset(); |
| 518 | 518 |
| 519 private: | 519 private: |
| 520 base::Time last_print_; | 520 base::Time last_print_; |
| 521 int count_ = 0; | 521 int count_ = 0; |
| 522 DISALLOW_COPY_AND_ASSIGN(ScriptingThrottler); | 522 DISALLOW_COPY_AND_ASSIGN(ScriptingThrottler); |
| 523 }; | 523 }; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 537 base::Closure on_stop_loading_closure_; | 537 base::Closure on_stop_loading_closure_; |
| 538 | 538 |
| 539 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 539 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
| 540 | 540 |
| 541 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 541 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 542 }; | 542 }; |
| 543 | 543 |
| 544 } // namespace printing | 544 } // namespace printing |
| 545 | 545 |
| 546 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 546 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |