Chromium Code Reviews| 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/monitor.h" | 8 #include "ui/gfx/monitor.h" |
| 9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
| 10 #include "ui/gfx/screen_impl.h" | 10 #include "ui/gfx/screen_impl.h" |
| 11 | 11 |
| 12 namespace gfx { | 12 namespace gfx { |
| 13 | 13 |
| 14 // 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, |
| 15 // gfx::Screen is pluggable and Desktop plugs in the real implementation. | 15 // gfx::Screen is pluggable and Desktop plugs in the real implementation. |
| 16 namespace { | 16 namespace { |
| 17 ScreenImpl* g_instance_ = NULL; | 17 ScreenImpl* g_instance_ = NULL; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 void Screen::SetInstance(ScreenImpl* screen) { | 21 void Screen::SetInstance(ScreenImpl* screen) { |
| 22 delete g_instance_; | 22 delete g_instance_; |
| 23 g_instance_ = screen; | 23 g_instance_ = screen; |
| 24 } | 24 } |
| 25 | 25 |
| 26 #if defined(USE_ASH) | 26 #if defined(USE_AURA) |
|
sky
2012/04/30 21:15:35
Can this ifdef be removed entirely?
| |
| 27 // TODO(oshima): Implement ScreenImpl for Linux/aura and remove this | 27 // TODO(oshima): Implement ScreenImpl for Linux/aura and remove this |
| 28 // ifdef. | 28 // ifdef. |
| 29 | 29 |
| 30 // static | 30 // static |
| 31 Point Screen::GetCursorScreenPoint() { | 31 Point Screen::GetCursorScreenPoint() { |
| 32 return g_instance_->GetCursorScreenPoint(); | 32 return g_instance_->GetCursorScreenPoint(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 // static | 35 // static |
| 36 NativeWindow Screen::GetWindowAtCursorScreenPoint() { | 36 NativeWindow Screen::GetWindowAtCursorScreenPoint() { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 58 } | 58 } |
| 59 | 59 |
| 60 // static | 60 // static |
| 61 Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) { | 61 Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) { |
| 62 return g_instance_->GetMonitorNearestPoint(match_rect.CenterPoint()); | 62 return g_instance_->GetMonitorNearestPoint(match_rect.CenterPoint()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 #endif | 65 #endif |
| 66 | 66 |
| 67 } // namespace gfx | 67 } // namespace gfx |
| OLD | NEW |