| 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 #ifndef ASH_MONITOR_MULTI_MONITOR_MANAGER_H_ | 5 #ifndef ASH_MONITOR_MULTI_MONITOR_MANAGER_H_ |
| 6 #define ASH_MONITOR_MULTI_MONITOR_MANAGER_H_ | 6 #define ASH_MONITOR_MULTI_MONITOR_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "ui/aura/monitor_manager.h" | 12 #include "ui/aura/monitor_manager.h" |
| 13 #include "ui/aura/root_window_observer.h" | 13 #include "ui/aura/root_window_observer.h" |
| 14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 15 | 15 |
| 16 namespace gfx { |
| 17 class Monitor; |
| 18 } |
| 19 |
| 16 namespace ash { | 20 namespace ash { |
| 17 namespace internal { | 21 namespace internal { |
| 18 | 22 |
| 19 // MultiMonitorManager maintains the current monitor configurations, | 23 // MultiMonitorManager maintains the current monitor configurations, |
| 20 // and notifies observers when configuration changes. | 24 // and notifies observers when configuration changes. |
| 21 // This is exported for unittest. | 25 // This is exported for unittest. |
| 22 // | 26 // |
| 23 // TODO(oshima): gfx::Screen needs to return translated coordinates | 27 // TODO(oshima): gfx::Screen needs to return translated coordinates |
| 24 // if the root window is translated. crbug.com/119268. | 28 // if the root window is translated. crbug.com/119268. |
| 25 class ASH_EXPORT MultiMonitorManager : public aura::MonitorManager, | 29 class ASH_EXPORT MultiMonitorManager : public aura::MonitorManager, |
| 26 public aura::RootWindowObserver { | 30 public aura::RootWindowObserver { |
| 27 public: | 31 public: |
| 28 MultiMonitorManager(); | 32 MultiMonitorManager(); |
| 29 virtual ~MultiMonitorManager(); | 33 virtual ~MultiMonitorManager(); |
| 30 | 34 |
| 31 // Used to emulate monitor change when run in a desktop environment instead | 35 // Used to emulate monitor change when run in a desktop environment instead |
| 32 // of on a device. | 36 // of on a device. |
| 33 static void AddRemoveMonitor(); | 37 static void AddRemoveMonitor(); |
| 34 static void CycleMonitor(); | 38 static void CycleMonitor(); |
| 35 | 39 |
| 36 // MonitorManager overrides: | 40 // MonitorManager overrides: |
| 37 virtual void OnNativeMonitorsChanged( | 41 virtual void OnNativeMonitorsChanged( |
| 38 const std::vector<const aura::Monitor*>& monitors) OVERRIDE; | 42 const std::vector<const gfx::Monitor*>& monitors) OVERRIDE; |
| 39 virtual aura::RootWindow* CreateRootWindowForMonitor( | 43 virtual aura::RootWindow* CreateRootWindowForMonitor( |
| 40 aura::Monitor* monitor) OVERRIDE; | 44 gfx::Monitor* monitor) OVERRIDE; |
| 41 virtual const aura::Monitor* GetMonitorNearestWindow( | 45 virtual gfx::Monitor* GetMonitorAt(size_t index) OVERRIDE; |
| 46 |
| 47 virtual size_t GetNumMonitors() const OVERRIDE; |
| 48 virtual const gfx::Monitor* GetMonitorNearestWindow( |
| 42 const aura::Window* window) const OVERRIDE; | 49 const aura::Window* window) const OVERRIDE; |
| 43 virtual const aura::Monitor* GetMonitorNearestPoint( | 50 virtual const gfx::Monitor* GetMonitorNearestPoint( |
| 44 const gfx::Point& point) const OVERRIDE; | 51 const gfx::Point& point) const OVERRIDE; |
| 45 virtual aura::Monitor* GetMonitorAt(size_t index) OVERRIDE; | 52 virtual gfx::Monitor* GetMonitorNearestWindow( |
| 46 virtual size_t GetNumMonitors() const OVERRIDE; | |
| 47 virtual aura::Monitor* GetMonitorNearestWindow( | |
| 48 const aura::Window* window) OVERRIDE; | 53 const aura::Window* window) OVERRIDE; |
| 49 | 54 |
| 50 // RootWindowObserver overrides: | 55 // RootWindowObserver overrides: |
| 51 virtual void OnRootWindowResized(const aura::RootWindow* root, | 56 virtual void OnRootWindowResized(const aura::RootWindow* root, |
| 52 const gfx::Size& new_size) OVERRIDE; | 57 const gfx::Size& new_size) OVERRIDE; |
| 53 | 58 |
| 54 private: | 59 private: |
| 55 typedef std::vector<aura::Monitor*> Monitors; | 60 typedef std::vector<gfx::Monitor*> Monitors; |
| 56 | 61 |
| 57 void Init(); | 62 void Init(); |
| 58 void AddRemoveMonitorImpl(); | 63 void AddRemoveMonitorImpl(); |
| 59 void CycleMonitorImpl(); | 64 void CycleMonitorImpl(); |
| 60 | 65 |
| 61 Monitors monitors_; | 66 Monitors monitors_; |
| 62 | 67 |
| 63 DISALLOW_COPY_AND_ASSIGN(MultiMonitorManager); | 68 DISALLOW_COPY_AND_ASSIGN(MultiMonitorManager); |
| 64 }; | 69 }; |
| 65 | 70 |
| 66 extern const aura::WindowProperty<aura::Monitor*>* const kMonitorKey; | 71 extern const aura::WindowProperty<gfx::Monitor*>* const kMonitorKey; |
| 67 | 72 |
| 68 } // namespace internal | 73 } // namespace internal |
| 69 } // namespace ash | 74 } // namespace ash |
| 70 | 75 |
| 71 #endif // ASH_MONITOR_MULTI_MONITOR_MANAGER_H_ | 76 #endif // ASH_MONITOR_MULTI_MONITOR_MANAGER_H_ |
| OLD | NEW |