| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 // Returns true if printing is overridden and the default behavior should be | 106 // Returns true if printing is overridden and the default behavior should be |
| 107 // skipped for |frame|. | 107 // skipped for |frame|. |
| 108 virtual bool OverridePrint(blink::WebLocalFrame* frame) = 0; | 108 virtual bool OverridePrint(blink::WebLocalFrame* frame) = 0; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 PrintWebViewHelper(content::RenderView* render_view, | 111 PrintWebViewHelper(content::RenderView* render_view, |
| 112 std::unique_ptr<Delegate> delegate); | 112 std::unique_ptr<Delegate> delegate); |
| 113 ~PrintWebViewHelper() override; | 113 ~PrintWebViewHelper() override; |
| 114 | 114 |
| 115 // Minimum valid value for scaling. Since scaling is originally an integer |
| 116 // representing a percentage, it should never be less than this if it is |
| 117 // valid. |
| 118 static constexpr double kEpsilon = 0.01f; |
| 119 |
| 115 // Disable print preview and switch to system dialog printing even if full | 120 // Disable print preview and switch to system dialog printing even if full |
| 116 // printing is build-in. This method is used by CEF. | 121 // printing is build-in. This method is used by CEF. |
| 117 static void DisablePreview(); | 122 static void DisablePreview(); |
| 118 | 123 |
| 119 bool IsPrintingEnabled(); | 124 bool IsPrintingEnabled(); |
| 120 | 125 |
| 121 void PrintNode(const blink::WebNode& node); | 126 void PrintNode(const blink::WebNode& node); |
| 122 | 127 |
| 123 private: | 128 private: |
| 124 friend class PrintWebViewHelperTestBase; | 129 friend class PrintWebViewHelperTestBase; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 base::Closure on_stop_loading_closure_; | 531 base::Closure on_stop_loading_closure_; |
| 527 | 532 |
| 528 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; | 533 base::WeakPtrFactory<PrintWebViewHelper> weak_ptr_factory_; |
| 529 | 534 |
| 530 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); | 535 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelper); |
| 531 }; | 536 }; |
| 532 | 537 |
| 533 } // namespace printing | 538 } // namespace printing |
| 534 | 539 |
| 535 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ | 540 #endif // COMPONENTS_PRINTING_RENDERER_PRINT_WEB_VIEW_HELPER_H_ |
| OLD | NEW |