Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: components/printing/renderer/print_web_view_helper.h

Issue 2454293004: Printing: Fix undefined behavior for near 0 scaling (Closed)
Patch Set: Fix declaration Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/printing/renderer/print_web_view_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | components/printing/renderer/print_web_view_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698