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 #include "ui/gfx/screen.h" | 5 #include "ui/gfx/screen.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/gfx/display.h" | |
9 #include "ui/gfx/native_widget_types.h" | |
10 #include "ui/gfx/screen_impl.h" | |
11 | 8 |
12 namespace gfx { | 9 namespace gfx { |
13 | 10 |
14 // gfx can't depend upon aura, otherwise we have circular dependencies. So, | 11 Screen* CreateNativeScreen() { |
15 // gfx::Screen is pluggable and Desktop plugs in the real implementation. | 12 NOTREACHED() << "Implementation should be installed at higher level."; |
16 namespace { | 13 return NULL; |
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 // static | |
27 bool Screen::IsDIPEnabled() { | |
28 return true; | |
29 } | |
30 | |
31 // static | |
32 Point Screen::GetCursorScreenPoint() { | |
33 return g_instance_->GetCursorScreenPoint(); | |
34 } | |
35 | |
36 // static | |
37 NativeWindow Screen::GetWindowAtCursorScreenPoint() { | |
38 return g_instance_->GetWindowAtCursorScreenPoint(); | |
39 } | |
40 | |
41 // static | |
42 int Screen::GetNumDisplays() { | |
43 return g_instance_->GetNumDisplays(); | |
44 } | |
45 | |
46 // static | |
47 Display Screen::GetDisplayNearestWindow(NativeView window) { | |
48 return g_instance_->GetDisplayNearestWindow(window); | |
49 } | |
50 | |
51 // static | |
52 Display Screen::GetDisplayNearestPoint(const Point& point) { | |
53 return g_instance_->GetDisplayNearestPoint(point); | |
54 } | |
55 | |
56 // static | |
57 Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { | |
58 return g_instance_->GetDisplayMatching(match_rect); | |
59 } | |
60 | |
61 // static | |
62 Display Screen::GetPrimaryDisplay() { | |
63 return g_instance_->GetPrimaryDisplay(); | |
64 } | 14 } |
65 | 15 |
66 } // namespace gfx | 16 } // namespace gfx |
OLD | NEW |