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/aura/monitor_manager.h" |
| 6 |
| 7 namespace arua { |
| 8 namespace internal { |
| 9 |
| 10 class MonitorManagerX11 : public MonitorManager { |
| 11 SingleMonitorManager::SingleMonitorManager(RootWindow* root_window) |
| 12 : root_window_(root_window) { |
| 13 Update(); |
| 14 } |
| 15 MonitorManagerX11::~MonitorManager() { |
| 16 STLDeleteContainerPointers(monitors_.begin(), monitors_.end()); |
| 17 } |
| 18 |
| 19 void MonitorManager::Update() { |
| 20 } |
| 21 |
| 22 const Monitor* SingleMonitorManager::GetMonitorNearestWindow( |
| 23 const aura::Window* window) const { |
| 24 return GetMonitorNearestPoint(window->bounds().origin()); |
| 25 } |
| 26 |
| 27 const Monitor* SingleMonitorManager::GetMonitorNearestPoint( |
| 28 const gfx::Point& point) const { |
| 29 for (Monitors::const_iterator iter = monitors_.begin(); |
| 30 iter != monitors_.end(); ++iter) { |
| 31 if ((*iter)->bounds().Contains(point)) |
| 32 return *iter; |
| 33 } |
| 34 return ; |
| 35 } |
| 36 |
| 37 const Monitor* SingleMonitorManager::GetPrimaryMonitor() const { |
| 38 return monitors_[0]; |
| 39 } |
| 40 |
| 41 size_t MonitorManager::GetNumMonitors() const { |
| 42 return monitors_.size(); |
| 43 } |
| 44 |
| 45 Monitor* MonitorManager::GetMonitorNearestWindow(const Window* window) { |
| 46 return const_cast<Monitor*>( |
| 47 GetMonitorNearestPoint(window->bounds().origin())); |
| 48 } |
| 49 |
| 50 } // namespace internal |
| 51 } // namespace aura |
OLD | NEW |