OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ui/gfx/screen.h" | 5 #include "ui/gfx/screen.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "ui/aura/desktop.h" |
| 13 #include "ui/aura/window.h" |
12 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
13 | 15 |
14 namespace gfx { | 16 namespace gfx { |
15 | 17 |
16 // static | 18 // static |
17 gfx::Point Screen::GetCursorScreenPoint() { | 19 gfx::Point Screen::GetCursorScreenPoint() { |
18 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
19 POINT pt; | 21 POINT pt; |
20 GetCursorPos(&pt); | 22 GetCursorPos(&pt); |
21 return gfx::Point(pt); | 23 return gfx::Point(pt); |
22 #endif | 24 #endif |
23 NOTIMPLEMENTED(); | 25 NOTIMPLEMENTED(); |
24 return gfx::Point(); | 26 return gfx::Point(); |
25 } | 27 } |
26 | 28 |
27 // static | 29 // static |
28 gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(gfx::NativeWindow window) { | 30 gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(gfx::NativeWindow window) { |
29 NOTIMPLEMENTED(); | 31 // TODO(oshima): Take window into account. Support multiple monitors. |
30 return gfx::Rect(); | 32 aura::Window* desktop_window = aura::Desktop::GetInstance()->window(); |
| 33 return desktop_window->bounds(); |
31 } | 34 } |
32 | 35 |
33 // static | 36 // static |
34 gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeWindow window) { | 37 gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeWindow window) { |
35 NOTIMPLEMENTED(); | 38 // TODO(oshima): Fix this for aura desktop. |
36 return gfx::Rect(); | 39 return GetMonitorAreaNearestWindow(window); |
37 } | 40 } |
38 | 41 |
39 static gfx::Rect GetMonitorAreaOrWorkAreaNearestPoint(const gfx::Point& point, | 42 static gfx::Rect GetMonitorAreaOrWorkAreaNearestPoint(const gfx::Point& point, |
40 bool work_area) { | 43 bool work_area) { |
41 NOTIMPLEMENTED(); | 44 // TODO(oshima): Take point/work_area into account. Support multiple monitors. |
42 return gfx::Rect(); | 45 aura::Window* desktop_window = aura::Desktop::GetInstance()->window(); |
| 46 return desktop_window->bounds(); |
43 } | 47 } |
44 | 48 |
45 // static | 49 // static |
46 gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) { | 50 gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) { |
47 return GetMonitorAreaOrWorkAreaNearestPoint(point, true); | 51 return GetMonitorAreaOrWorkAreaNearestPoint(point, true); |
48 } | 52 } |
49 | 53 |
50 // static | 54 // static |
51 gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) { | 55 gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) { |
52 return GetMonitorAreaOrWorkAreaNearestPoint(point, false); | 56 return GetMonitorAreaOrWorkAreaNearestPoint(point, false); |
53 } | 57 } |
54 | 58 |
55 gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() { | 59 gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() { |
56 NOTIMPLEMENTED(); | 60 NOTIMPLEMENTED(); |
57 return NULL; | 61 return NULL; |
58 } | 62 } |
59 | 63 |
60 } // namespace gfx | 64 } // namespace gfx |
OLD | NEW |