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

Unified Diff: ui/base/layout.h

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/layout.h
diff --git a/ui/base/layout.h b/ui/base/layout.h
index 1292c38f2c5120dfda672fa36f719f53c54478e9..0eaf9d4979ce04180a255aee4242a8b63a8f6eb2 100644
--- a/ui/base/layout.h
+++ b/ui/base/layout.h
@@ -46,6 +46,16 @@ enum ScaleFactor {
NUM_SCALE_FACTORS // This always appears last.
};
+// Changes the value of GetSupportedScaleFactors() to |scale_factors|.
+// Use ScopedSetSupportedScaleFactors for unit tests as not to affect the
+// state of other tests.
+UI_EXPORT void SetSupportedScaleFactors(
+ const std::vector<ScaleFactor>& scale_factors);
+
+// Returns a vector with the scale factors which are supported by this
+// platform, in ascending order.
+UI_EXPORT const std::vector<ScaleFactor>& GetSupportedScaleFactors();
+
// Returns the float scale value for |scale_factor|.
UI_EXPORT float GetScaleFactorScale(ScaleFactor scale_factor);
@@ -59,23 +69,17 @@ UI_EXPORT ScaleFactor GetScaleFactorFromScale(float scale);
UI_EXPORT ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view);
// Returns the maximum device scale factor supported by this platform.
-UI_EXPORT ScaleFactor GetMaxScaleFactor();
-
-// Returns a vector with the scale factors which are supported by this
-// platform, in ascending order.
-UI_EXPORT std::vector<ScaleFactor> GetSupportedScaleFactors();
+UI_EXPORT ScaleFactor GetMaxSupportedScaleFactor();
// Returns true if |scale_factor| is supported by this platform.
UI_EXPORT bool IsScaleFactorSupported(ScaleFactor scale_factor);
-namespace test {
-
-// Changes the value of GetSupportedScaleFactors() to |scale_factors|.
-// Use ScopedSetSupportedScaleFactors for unit tests as not to affect the
-// state of other tests.
-UI_EXPORT void SetSupportedScaleFactors(
- const std::vector<ScaleFactor>& scale_factors);
+// Returns the scale factor closest to |scale| from the full list of factors.
+// Note that it does NOT rely on the list of supported scale factors.
+// Finding the closest match is inefficient and shouldn't be done frequently.
+UI_EXPORT ScaleFactor FindClosestScaleFactorUnsafe(float scale);
+namespace test {
// Class which changes the value of GetSupportedScaleFactors() to
// |new_scale_factors| for the duration of its lifetime.
class UI_EXPORT ScopedSetSupportedScaleFactors {

Powered by Google App Engine
This is Rietveld 408576698