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