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_GFX_SCREEN_H_ | 5 #ifndef UI_GFX_SCREEN_H_ |
6 #define UI_GFX_SCREEN_H_ | 6 #define UI_GFX_SCREEN_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ui/base/ui_export.h" | 9 #include "ui/base/ui_export.h" |
10 #include "ui/gfx/display.h" | 10 #include "ui/gfx/display.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 #include "ui/gfx/point.h" | 12 #include "ui/gfx/point.h" |
| 13 #include "ui/gfx/screen_type_delegate.h" |
13 | 14 |
14 namespace gfx { | 15 namespace gfx { |
15 class Rect; | 16 class Rect; |
16 class ScreenImpl; | 17 class ScreenImpl; |
17 | 18 |
18 // A utility class for getting various info about screen size, displays, | 19 // A utility class for getting various info about screen size, displays, |
19 // cursor position, etc. | 20 // cursor position, etc. |
20 class UI_EXPORT Screen { | 21 class UI_EXPORT Screen { |
21 public: | 22 public: |
22 #if defined(USE_AURA) | 23 #if defined(USE_AURA) |
23 // Sets the instance to use. This takes owernship of |screen|, deleting the | 24 // This is used on aura to avoid circular dependencies between ui and aura. |
24 // old instance. This is used on aura to avoid circular dependencies between | 25 static void SetInstance(ScreenType type, ScreenImpl* screen); |
25 // ui and aura. | 26 // TODO(scottmg): http://crbug.com/133312 |
26 static void SetInstance(ScreenImpl* screen); | 27 static void SetScreenTypeDelegate(ScreenTypeDelegate* delegate); |
| 28 static void ForceScreenTypeOverride(ScreenType type); |
27 #endif | 29 #endif |
28 | 30 |
29 // Returns true if DIP is enabled. | 31 // Returns true if DIP is enabled. |
30 static bool IsDIPEnabled(); | 32 static bool IsDIPEnabled(); |
31 | 33 |
32 // Returns the current absolute position of the mouse pointer. | 34 // Returns the current absolute position of the mouse pointer. |
33 static gfx::Point GetCursorScreenPoint(); | 35 static gfx::Point GetCursorScreenPoint(NativeView context); |
34 | 36 |
35 // Returns the window under the cursor. | 37 // Returns the window under the cursor. |
36 static gfx::NativeWindow GetWindowAtCursorScreenPoint(); | 38 static gfx::NativeWindow GetWindowAtCursorScreenPoint( |
| 39 NativeView context); |
37 | 40 |
38 // Returns the number of displays. | 41 // Returns the number of displays. |
39 // Mirrored displays are excluded; this method is intended to return the | 42 // Mirrored displays are excluded; this method is intended to return the |
40 // number of distinct, usable displays. | 43 // number of distinct, usable displays. |
41 static int GetNumDisplays(); | 44 static int GetNumDisplays(NativeView context); |
42 | 45 |
43 // Returns the display nearest the specified window. | 46 // Returns the display nearest the specified window. |
44 static gfx::Display GetDisplayNearestWindow(gfx::NativeView view); | 47 static gfx::Display GetDisplayNearestWindow(NativeView view); |
45 | 48 |
46 // Returns the the display nearest the specified point. | 49 // Returns the the display nearest the specified point. |
47 static gfx::Display GetDisplayNearestPoint(const gfx::Point& point); | 50 static gfx::Display GetDisplayNearestPoint( |
| 51 NativeView context, const gfx::Point& point); |
48 | 52 |
49 // Returns the display that most closely intersects the provided bounds. | 53 // Returns the display that most closely intersects the provided bounds. |
50 static gfx::Display GetDisplayMatching(const gfx::Rect& match_rect); | 54 static gfx::Display GetDisplayMatching( |
| 55 NativeView context, const gfx::Rect& match_rect); |
51 | 56 |
52 // Returns the primary display. | 57 // Returns the primary display. |
53 static gfx::Display GetPrimaryDisplay(); | 58 static gfx::Display GetPrimaryDisplay(NativeView context); |
| 59 |
| 60 static gfx::NativeView BadTwoWorldsContext(); |
54 | 61 |
55 private: | 62 private: |
56 DISALLOW_IMPLICIT_CONSTRUCTORS(Screen); | 63 DISALLOW_IMPLICIT_CONSTRUCTORS(Screen); |
57 }; | 64 }; |
58 | 65 |
59 } // namespace gfx | 66 } // namespace gfx |
60 | 67 |
61 #endif // UI_GFX_SCREEN_H_ | 68 #endif // UI_GFX_SCREEN_H_ |
OLD | NEW |