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

Side by Side Diff: ui/base/layout.h

Issue 291073002: Move IsScaleFactorSupported, FindClosestScaleFactorUnsafe to ui/base/resource_bundle.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/base/layout.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 UI_BASE_LAYOUT_H_ 5 #ifndef UI_BASE_LAYOUT_H_
6 #define UI_BASE_LAYOUT_H_ 6 #define UI_BASE_LAYOUT_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 // Returns the supported ScaleFactor which most closely matches |scale|. 49 // Returns the supported ScaleFactor which most closely matches |scale|.
50 // Converting from float to ScaleFactor is inefficient and should be done as 50 // Converting from float to ScaleFactor is inefficient and should be done as
51 // little as possible. 51 // little as possible.
52 // TODO(oshima): Make ScaleFactor a class and remove this. 52 // TODO(oshima): Make ScaleFactor a class and remove this.
53 UI_BASE_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale); 53 UI_BASE_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale);
54 54
55 // Returns the ScaleFactor used by |view|. 55 // Returns the ScaleFactor used by |view|.
56 UI_BASE_EXPORT float GetScaleFactorForNativeView(gfx::NativeView view); 56 UI_BASE_EXPORT float GetScaleFactorForNativeView(gfx::NativeView view);
57 57
58 // Returns true if |scale_factor| is supported by this platform.
59 UI_BASE_EXPORT bool IsScaleFactorSupported(ScaleFactor scale_factor);
60
61 // Returns the scale factor closest to |scale| from the full list of factors.
62 // Note that it does NOT rely on the list of supported scale factors.
63 // Finding the closest match is inefficient and shouldn't be done frequently.
64 UI_BASE_EXPORT ScaleFactor FindClosestScaleFactorUnsafe(float scale);
65
66 // Returns the image scale for the scale factor passed in. 58 // Returns the image scale for the scale factor passed in.
67 UI_BASE_EXPORT float GetScaleForScaleFactor(ScaleFactor scale_factor); 59 UI_BASE_EXPORT float GetScaleForScaleFactor(ScaleFactor scale_factor);
68 60
69 namespace test { 61 namespace test {
70 // Class which changes the value of GetSupportedScaleFactors() to 62 // Class which changes the value of GetSupportedScaleFactors() to
71 // |new_scale_factors| for the duration of its lifetime. 63 // |new_scale_factors| for the duration of its lifetime.
72 class UI_BASE_EXPORT ScopedSetSupportedScaleFactors { 64 class UI_BASE_EXPORT ScopedSetSupportedScaleFactors {
73 public: 65 public:
74 explicit ScopedSetSupportedScaleFactors( 66 explicit ScopedSetSupportedScaleFactors(
75 const std::vector<ui::ScaleFactor>& new_scale_factors); 67 const std::vector<ui::ScaleFactor>& new_scale_factors);
76 ~ScopedSetSupportedScaleFactors(); 68 ~ScopedSetSupportedScaleFactors();
77 69
78 private: 70 private:
79 std::vector<ui::ScaleFactor>* original_scale_factors_; 71 std::vector<ui::ScaleFactor>* original_scale_factors_;
80 72
81 DISALLOW_COPY_AND_ASSIGN(ScopedSetSupportedScaleFactors); 73 DISALLOW_COPY_AND_ASSIGN(ScopedSetSupportedScaleFactors);
82 }; 74 };
83 75
84 } // namespace test 76 } // namespace test
85 77
86 } // namespace ui 78 } // namespace ui
87 79
88 #endif // UI_BASE_LAYOUT_H_ 80 #endif // UI_BASE_LAYOUT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/base/layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698