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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // Retrieves the Screen that the specified NativeView belongs to. A value of | 30 // Retrieves the Screen that the specified NativeView belongs to. A value of |
31 // NULL is treated as |SCREEN_TYPE_NATIVE|. | 31 // NULL is treated as |SCREEN_TYPE_NATIVE|. |
32 static Screen* GetScreenFor(NativeView view); | 32 static Screen* GetScreenFor(NativeView view); |
33 | 33 |
34 // Returns the SCREEN_TYPE_NATIVE Screen. This should be used with caution, | 34 // Returns the SCREEN_TYPE_NATIVE Screen. This should be used with caution, |
35 // as it is likely to be incorrect for code that runs on Windows. | 35 // as it is likely to be incorrect for code that runs on Windows. |
36 static Screen* GetNativeScreen(); | 36 static Screen* GetNativeScreen(); |
37 | 37 |
38 // Sets the global screen for a particular screen type. Only the _NATIVE | 38 // Sets the global screen for a particular screen type. Only the _NATIVE |
39 // ScreenType must be provided. | 39 // ScreenType must be provided. |
| 40 // NOTE: this does not take ownership of |screen|. Tests must be sure to |
| 41 // reset any state they install. |
40 static void SetScreenInstance(ScreenType type, Screen* instance); | 42 static void SetScreenInstance(ScreenType type, Screen* instance); |
41 | 43 |
42 // Returns the global screen for a particular type. Types other than _NATIVE | 44 // Returns the global screen for a particular type. Types other than _NATIVE |
43 // may be NULL. | 45 // may be NULL. |
44 static Screen* GetScreenByType(ScreenType type); | 46 static Screen* GetScreenByType(ScreenType type); |
45 | 47 |
46 // Sets the global ScreenTypeDelegate. May be left unset if the platform | 48 // Sets the global ScreenTypeDelegate. May be left unset if the platform |
47 // uses only the _NATIVE ScreenType. | 49 // uses only the _NATIVE ScreenType. |
| 50 // NOTE: this does not take ownership of |delegate|. Tests must be sure to |
| 51 // reset any state they install. |
48 static void SetScreenTypeDelegate(ScreenTypeDelegate* delegate); | 52 static void SetScreenTypeDelegate(ScreenTypeDelegate* delegate); |
49 | 53 |
50 Screen(); | 54 Screen(); |
51 virtual ~Screen(); | 55 virtual ~Screen(); |
52 | 56 |
53 // Returns the current absolute position of the mouse pointer. | 57 // Returns the current absolute position of the mouse pointer. |
54 virtual gfx::Point GetCursorScreenPoint() = 0; | 58 virtual gfx::Point GetCursorScreenPoint() = 0; |
55 | 59 |
56 // Returns the window under the cursor. | 60 // Returns the window under the cursor. |
57 virtual gfx::NativeWindow GetWindowUnderCursor() = 0; | 61 virtual gfx::NativeWindow GetWindowUnderCursor() = 0; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 93 |
90 private: | 94 private: |
91 DISALLOW_COPY_AND_ASSIGN(Screen); | 95 DISALLOW_COPY_AND_ASSIGN(Screen); |
92 }; | 96 }; |
93 | 97 |
94 Screen* CreateNativeScreen(); | 98 Screen* CreateNativeScreen(); |
95 | 99 |
96 } // namespace gfx | 100 } // namespace gfx |
97 | 101 |
98 #endif // UI_GFX_SCREEN_H_ | 102 #endif // UI_GFX_SCREEN_H_ |
OLD | NEW |