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