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/compositor/dip_util.h" | |
9 #include "ui/gfx/monitor.h" | 8 #include "ui/gfx/monitor.h" |
10 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
11 #include "ui/gfx/screen_impl.h" | 10 #include "ui/gfx/screen_impl.h" |
12 | 11 |
13 namespace gfx { | 12 namespace gfx { |
14 | 13 |
15 // gfx can't depend upon aura, otherwise we have circular dependencies. So, | 14 // gfx can't depend upon aura, otherwise we have circular dependencies. So, |
16 // gfx::Screen is pluggable and Desktop plugs in the real implementation. | 15 // gfx::Screen is pluggable and Desktop plugs in the real implementation. |
17 namespace { | 16 namespace { |
18 ScreenImpl* g_instance_ = NULL; | 17 ScreenImpl* g_instance_ = NULL; |
19 } | 18 } |
20 | 19 |
21 // static | 20 // static |
22 void Screen::SetInstance(ScreenImpl* screen) { | 21 void Screen::SetInstance(ScreenImpl* screen) { |
23 delete g_instance_; | 22 delete g_instance_; |
24 g_instance_ = screen; | 23 g_instance_ = screen; |
25 } | 24 } |
26 | 25 |
27 // TODO(oshima): Implement ScreenImpl for Linux/aura and remove this | 26 // TODO(oshima): Implement ScreenImpl for Linux/aura and remove this |
28 // ifdef. | 27 // ifdef. |
29 | 28 |
30 // static | 29 // static |
31 bool Screen::IsDIPEnabled() { | |
32 return ui::IsDIPEnabled(); | |
33 } | |
34 | |
35 // static | |
36 Point Screen::GetCursorScreenPoint() { | 30 Point Screen::GetCursorScreenPoint() { |
37 return g_instance_->GetCursorScreenPoint(); | 31 return g_instance_->GetCursorScreenPoint(); |
38 } | 32 } |
39 | 33 |
40 // static | 34 // static |
41 NativeWindow Screen::GetWindowAtCursorScreenPoint() { | 35 NativeWindow Screen::GetWindowAtCursorScreenPoint() { |
42 return g_instance_->GetWindowAtCursorScreenPoint(); | 36 return g_instance_->GetWindowAtCursorScreenPoint(); |
43 } | 37 } |
44 | 38 |
45 // static | 39 // static |
(...skipping 15 matching lines...) Expand all Loading... |
61 Monitor Screen::GetPrimaryMonitor() { | 55 Monitor Screen::GetPrimaryMonitor() { |
62 return g_instance_->GetPrimaryMonitor(); | 56 return g_instance_->GetPrimaryMonitor(); |
63 } | 57 } |
64 | 58 |
65 // static | 59 // static |
66 Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) { | 60 Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) { |
67 return g_instance_->GetMonitorNearestPoint(match_rect.CenterPoint()); | 61 return g_instance_->GetMonitorNearestPoint(match_rect.CenterPoint()); |
68 } | 62 } |
69 | 63 |
70 } // namespace gfx | 64 } // namespace gfx |
OLD | NEW |