OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/gfx/screen.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "ui/gfx/monitor.h" | |
9 #include "ui/gfx/native_widget_types.h" | |
10 #include "ui/gfx/screen_impl.h" | |
11 | |
12 namespace gfx { | |
13 | |
14 // gfx can't depend upon aura, otherwise we have circular dependencies. So, | |
15 // gfx::Screen is pluggable and Desktop plugs in the real implementation. | |
16 namespace { | |
17 ScreenImpl* g_instance_ = NULL; | |
18 } | |
19 | |
20 // static | |
21 void Screen::SetInstance(ScreenImpl* screen) { | |
22 delete g_instance_; | |
23 g_instance_ = screen; | |
24 } | |
25 | |
26 #if defined(USE_ASH) | |
Ben Goodger (Google)
2012/04/24 21:17:08
ui/gfx shouldn't have any knowledge of ash.
oshima
2012/04/25 02:38:01
This is unfortunate side effect of USE_AURA in scr
| |
27 // TODO(oshima): Implement ScreenImpl for Linux/aura and remove this | |
28 // ifdef. | |
29 | |
30 // static | |
31 Point Screen::GetCursorScreenPoint() { | |
32 return g_instance_->GetCursorScreenPoint(); | |
33 } | |
34 | |
35 // static | |
36 NativeWindow Screen::GetWindowAtCursorScreenPoint() { | |
37 return g_instance_->GetWindowAtCursorScreenPoint(); | |
38 } | |
39 | |
40 // static | |
41 int Screen::GetNumMonitors() { | |
42 return g_instance_->GetNumMonitors(); | |
43 } | |
44 | |
45 // static | |
46 Monitor Screen::GetMonitorNearestWindow(NativeView window) { | |
47 return g_instance_->GetMonitorNearestWindow(window); | |
48 } | |
49 | |
50 // static | |
51 Monitor Screen::GetMonitorNearestPoint(const Point& point) { | |
52 return g_instance_->GetMonitorNearestPoint(point); | |
53 } | |
54 | |
55 // static | |
56 Monitor Screen::GetPrimaryMonitor() { | |
57 return g_instance_->GetPrimaryMonitor(); | |
58 } | |
59 | |
60 // static | |
61 Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) { | |
62 return g_instance_->GetMonitorNearestPoint(match_rect.CenterPoint()); | |
63 } | |
64 | |
65 #endif | |
66 | |
67 } // namespace gfx | |
OLD | NEW |