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 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Converting from float to ScaleFactor is inefficient and should be done as | 47 // Converting from float to ScaleFactor is inefficient and should be done as |
48 // little as possible. | 48 // little as possible. |
49 UI_BASE_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale); | 49 UI_BASE_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale); |
50 | 50 |
51 // Returns the ScaleFactor used by |view|. | 51 // Returns the ScaleFactor used by |view|. |
52 UI_BASE_EXPORT float GetScaleFactorForNativeView(gfx::NativeView view); | 52 UI_BASE_EXPORT float GetScaleFactorForNativeView(gfx::NativeView view); |
53 | 53 |
54 // Returns the image scale for the scale factor passed in. | 54 // Returns the image scale for the scale factor passed in. |
55 UI_BASE_EXPORT float GetScaleForScaleFactor(ScaleFactor scale_factor); | 55 UI_BASE_EXPORT float GetScaleForScaleFactor(ScaleFactor scale_factor); |
56 | 56 |
| 57 // Returns true if the scale passed in is the list of supported scales for |
| 58 // the platform. |
| 59 UI_BASE_EXPORT bool IsSupportedScale(float scale); |
| 60 |
57 namespace test { | 61 namespace test { |
58 // Class which changes the value of GetSupportedScaleFactors() to | 62 // Class which changes the value of GetSupportedScaleFactors() to |
59 // |new_scale_factors| for the duration of its lifetime. | 63 // |new_scale_factors| for the duration of its lifetime. |
60 class UI_BASE_EXPORT ScopedSetSupportedScaleFactors { | 64 class UI_BASE_EXPORT ScopedSetSupportedScaleFactors { |
61 public: | 65 public: |
62 explicit ScopedSetSupportedScaleFactors( | 66 explicit ScopedSetSupportedScaleFactors( |
63 const std::vector<ui::ScaleFactor>& new_scale_factors); | 67 const std::vector<ui::ScaleFactor>& new_scale_factors); |
64 ~ScopedSetSupportedScaleFactors(); | 68 ~ScopedSetSupportedScaleFactors(); |
65 | 69 |
66 private: | 70 private: |
67 std::vector<ui::ScaleFactor>* original_scale_factors_; | 71 std::vector<ui::ScaleFactor>* original_scale_factors_; |
68 | 72 |
69 DISALLOW_COPY_AND_ASSIGN(ScopedSetSupportedScaleFactors); | 73 DISALLOW_COPY_AND_ASSIGN(ScopedSetSupportedScaleFactors); |
70 }; | 74 }; |
71 | 75 |
72 } // namespace test | 76 } // namespace test |
73 | 77 |
74 } // namespace ui | 78 } // namespace ui |
75 | 79 |
76 #endif // UI_BASE_LAYOUT_H_ | 80 #endif // UI_BASE_LAYOUT_H_ |
OLD | NEW |