| 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 "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Returns a vector with the scale factors which are supported by this | 24 // Returns a vector with the scale factors which are supported by this |
| 25 // platform, in ascending order. | 25 // platform, in ascending order. |
| 26 UI_BASE_EXPORT const std::vector<ScaleFactor>& GetSupportedScaleFactors(); | 26 UI_BASE_EXPORT const std::vector<ScaleFactor>& GetSupportedScaleFactors(); |
| 27 | 27 |
| 28 // Returns the supported ScaleFactor which most closely matches |scale|. | 28 // Returns the supported ScaleFactor which most closely matches |scale|. |
| 29 // Converting from float to ScaleFactor is inefficient and should be done as | 29 // Converting from float to ScaleFactor is inefficient and should be done as |
| 30 // little as possible. | 30 // little as possible. |
| 31 UI_BASE_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale); | 31 UI_BASE_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale); |
| 32 | 32 |
| 33 // Returns the ScaleFactor used by |view|. | 33 // Returns the ScaleFactor used by |view|. |
| 34 UI_BASE_EXPORT float GetScaleFactorForNativeView(gfx::NativeView view); | 34 UI_BASE_EXPORT float GetScaleFactorForNativeView(gfx::NativeViewId view); |
| 35 | 35 |
| 36 // Returns true if the scale passed in is the list of supported scales for | 36 // Returns true if the scale passed in is the list of supported scales for |
| 37 // the platform. | 37 // the platform. |
| 38 UI_BASE_EXPORT bool IsSupportedScale(float scale); | 38 UI_BASE_EXPORT bool IsSupportedScale(float scale); |
| 39 | 39 |
| 40 namespace test { | 40 namespace test { |
| 41 // Class which changes the value of GetSupportedScaleFactors() to | 41 // Class which changes the value of GetSupportedScaleFactors() to |
| 42 // |new_scale_factors| for the duration of its lifetime. | 42 // |new_scale_factors| for the duration of its lifetime. |
| 43 class UI_BASE_EXPORT ScopedSetSupportedScaleFactors { | 43 class UI_BASE_EXPORT ScopedSetSupportedScaleFactors { |
| 44 public: | 44 public: |
| 45 explicit ScopedSetSupportedScaleFactors( | 45 explicit ScopedSetSupportedScaleFactors( |
| 46 const std::vector<ui::ScaleFactor>& new_scale_factors); | 46 const std::vector<ui::ScaleFactor>& new_scale_factors); |
| 47 ~ScopedSetSupportedScaleFactors(); | 47 ~ScopedSetSupportedScaleFactors(); |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 std::vector<ui::ScaleFactor>* original_scale_factors_; | 50 std::vector<ui::ScaleFactor>* original_scale_factors_; |
| 51 | 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(ScopedSetSupportedScaleFactors); | 52 DISALLOW_COPY_AND_ASSIGN(ScopedSetSupportedScaleFactors); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace test | 55 } // namespace test |
| 56 | 56 |
| 57 } // namespace ui | 57 } // namespace ui |
| 58 | 58 |
| 59 #endif // UI_BASE_LAYOUT_H_ | 59 #endif // UI_BASE_LAYOUT_H_ |
| OLD | NEW |