Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: ash/monitor/multi_monitor_manager.h

Issue 9837046: Revert r128507 "Revert r128436 "relanding: disabled workspace_window_resizer test. fixed access-aft… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/monitor/monitor_controller.cc ('k') | ash/monitor/multi_monitor_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "ui/aura/monitor_manager.h" 12 #include "ui/aura/monitor_manager.h"
13 #include "ui/aura/root_window_observer.h"
12 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
13 #include "ui/aura/window_observer.h" 15 #include "ui/aura/window_observer.h"
14 16
15 namespace ash { 17 namespace ash {
16 namespace internal { 18 namespace internal {
17 19
18 class MultiMonitorManager : public aura::MonitorManager, 20 // MultiMonitorManager maintains the current monitor configurations,
19 public aura::WindowObserver { 21 // and notifies observers when configuration changes.
22 // This is exported for unittest.
23 //
24 // TODO(oshima): gfx::Screen needs to return translated coordinates
25 // if the root window is translated. crbug.com/119268.
26 class ASH_EXPORT MultiMonitorManager : public aura::MonitorManager,
27 public aura::RootWindowObserver,
28 public aura::WindowObserver {
20 public: 29 public:
21 MultiMonitorManager(); 30 MultiMonitorManager();
22 virtual ~MultiMonitorManager(); 31 virtual ~MultiMonitorManager();
23 32
33 // Used to emulate monitor change when run in a desktop environment instead
34 // of on a device.
35 static void AddRemoveMonitor();
36 static void CycleMonitor();
37
24 // MonitorManager overrides: 38 // MonitorManager overrides:
25 virtual void OnNativeMonitorResized(const gfx::Size& size) OVERRIDE; 39 virtual void OnNativeMonitorsChanged(
40 const std::vector<const aura::Monitor*>& monitors) OVERRIDE;
26 virtual aura::RootWindow* CreateRootWindowForMonitor( 41 virtual aura::RootWindow* CreateRootWindowForMonitor(
27 aura::Monitor* monitor) OVERRIDE; 42 aura::Monitor* monitor) OVERRIDE;
28 virtual const aura::Monitor* GetMonitorNearestWindow( 43 virtual const aura::Monitor* GetMonitorNearestWindow(
29 const aura::Window* window) const OVERRIDE; 44 const aura::Window* window) const OVERRIDE;
30 virtual const aura::Monitor* GetMonitorNearestPoint( 45 virtual const aura::Monitor* GetMonitorNearestPoint(
31 const gfx::Point& point) const OVERRIDE; 46 const gfx::Point& point) const OVERRIDE;
32 virtual aura::Monitor* GetMonitorAt(size_t index) OVERRIDE; 47 virtual aura::Monitor* GetMonitorAt(size_t index) OVERRIDE;
33 virtual size_t GetNumMonitors() const OVERRIDE; 48 virtual size_t GetNumMonitors() const OVERRIDE;
34 virtual aura::Monitor* GetMonitorNearestWindow( 49 virtual aura::Monitor* GetMonitorNearestWindow(
35 const aura::Window* window) OVERRIDE; 50 const aura::Window* window) OVERRIDE;
36 51
52 // RootWindowObserver overrides:
53 virtual void OnRootWindowResized(const aura::RootWindow* root,
54 const gfx::Size& new_size) OVERRIDE;
55
37 // WindowObserver overrides: 56 // WindowObserver overrides:
38 virtual void OnWindowBoundsChanged(aura::Window* window,
39 const gfx::Rect& bounds) OVERRIDE;
40 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; 57 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
41 58
42 private: 59 private:
43 typedef std::vector<aura::Monitor*> Monitors; 60 typedef std::vector<aura::Monitor*> Monitors;
44 61
45 void Init(); 62 void Init();
63 void AddRemoveMonitorImpl();
64 void CycleMonitorImpl();
46 65
47 Monitors monitors_; 66 Monitors monitors_;
48 67
49 DISALLOW_COPY_AND_ASSIGN(MultiMonitorManager); 68 DISALLOW_COPY_AND_ASSIGN(MultiMonitorManager);
50 }; 69 };
51 70
52 extern const aura::WindowProperty<aura::Monitor*>* const kMonitorKey; 71 extern const aura::WindowProperty<aura::Monitor*>* const kMonitorKey;
53 72
54 } // namespace internal 73 } // namespace internal
55 } // namespace ash 74 } // namespace ash
56 75
57 #endif // ASH_MONITOR_MULTI_MONITOR_MANAGER_H_ 76 #endif // ASH_MONITOR_MULTI_MONITOR_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/monitor/monitor_controller.cc ('k') | ash/monitor/multi_monitor_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698