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

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

Issue 10823067: Add a function to layout.h for getting ScaleFactor of the native view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
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"
11 #include "ui/base/ui_export.h" 11 #include "ui/base/ui_export.h"
12 #include "ui/gfx/native_widget_types.h"
12 13
13 namespace ui { 14 namespace ui {
14 15
15 enum DisplayLayout { 16 enum DisplayLayout {
16 // Layout optimized for ASH. This enum value should go away as soon as 17 // Layout optimized for ASH. This enum value should go away as soon as
17 // LAYOUT_DESKTOP and LAYOUT_ASH are the same. 18 // LAYOUT_DESKTOP and LAYOUT_ASH are the same.
18 LAYOUT_ASH, 19 LAYOUT_ASH,
19 20
20 // The typical layout for e.g. Windows, Mac and Linux. 21 // The typical layout for e.g. Windows, Mac and Linux.
21 LAYOUT_DESKTOP, 22 LAYOUT_DESKTOP,
(...skipping 20 matching lines...) Expand all
42 }; 43 };
43 44
44 // Returns the float scale value for |scale_factor|. 45 // Returns the float scale value for |scale_factor|.
45 UI_EXPORT float GetScaleFactorScale(ScaleFactor scale_factor); 46 UI_EXPORT float GetScaleFactorScale(ScaleFactor scale_factor);
46 47
47 // Returns the ScaleFactor which most closely matches |scale|. 48 // Returns the ScaleFactor which most closely matches |scale|.
48 // Converting from float to ScaleFactor is inefficient and should be done as 49 // Converting from float to ScaleFactor is inefficient and should be done as
49 // little as possible. 50 // little as possible.
50 UI_EXPORT ScaleFactor GetScaleFactorFromScale(float scale); 51 UI_EXPORT ScaleFactor GetScaleFactorFromScale(float scale);
51 52
53 // Returns the ScaleFactor used by |view|.
54 UI_EXPORT ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view);
55
52 #if defined(OS_MACOSX) 56 #if defined(OS_MACOSX)
53 57
54 // Returns a vector with the scale factors which are supported by this 58 // Returns a vector with the scale factors which are supported by this
55 // platform. 59 // platform.
56 // Only required on Mac so far. 60 // Only required on Mac so far.
57 UI_EXPORT std::vector<ScaleFactor> GetSupportedScaleFactors(); 61 UI_EXPORT std::vector<ScaleFactor> GetSupportedScaleFactors();
58 62
59 namespace test { 63 namespace test {
60 64
61 UI_EXPORT void SetSupportedScaleFactors( 65 UI_EXPORT void SetSupportedScaleFactors(
62 const std::vector<ScaleFactor>& scale_factors); 66 const std::vector<ScaleFactor>& scale_factors);
63 67
64 } // namespace test 68 } // namespace test
65 69
66 #endif 70 #endif
67 71
68 } // namespace ui 72 } // namespace ui
69 73
70 #endif // UI_BASE_LAYOUT_H_ 74 #endif // UI_BASE_LAYOUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698