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

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

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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 "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 Insets;
18 class Monitor;
19 }
20
16 namespace ash { 21 namespace ash {
17 namespace internal { 22 namespace internal {
18 23
19 // MultiMonitorManager maintains the current monitor configurations, 24 // MultiMonitorManager maintains the current monitor configurations,
20 // and notifies observers when configuration changes. 25 // and notifies observers when configuration changes.
21 // This is exported for unittest. 26 // This is exported for unittest.
22 // 27 //
23 // TODO(oshima): gfx::Screen needs to return translated coordinates 28 // TODO(oshima): gfx::Screen needs to return translated coordinates
24 // if the root window is translated. crbug.com/119268. 29 // if the root window is translated. crbug.com/119268.
25 class ASH_EXPORT MultiMonitorManager : public aura::MonitorManager, 30 class ASH_EXPORT MultiMonitorManager : public aura::MonitorManager,
26 public aura::RootWindowObserver { 31 public aura::RootWindowObserver {
27 public: 32 public:
28 MultiMonitorManager(); 33 MultiMonitorManager();
29 virtual ~MultiMonitorManager(); 34 virtual ~MultiMonitorManager();
30 35
31 // Used to emulate monitor change when run in a desktop environment instead 36 // Used to emulate monitor change when run in a desktop environment instead
32 // of on a device. 37 // of on a device.
33 static void AddRemoveMonitor(); 38 static void AddRemoveMonitor();
34 static void CycleMonitor(); 39 static void CycleMonitor();
35 40
41 bool UpdateWorkAreaOfMonitorNearestWindow(const aura::Window* window,
42 const gfx::Insets& insets);
43
36 // MonitorManager overrides: 44 // MonitorManager overrides:
37 virtual void OnNativeMonitorsChanged( 45 virtual void OnNativeMonitorsChanged(
38 const std::vector<const aura::Monitor*>& monitors) OVERRIDE; 46 const std::vector<gfx::Monitor>& monitors) OVERRIDE;
39 virtual aura::RootWindow* CreateRootWindowForMonitor( 47 virtual aura::RootWindow* CreateRootWindowForMonitor(
40 aura::Monitor* monitor) OVERRIDE; 48 const gfx::Monitor& monitor) OVERRIDE;
41 virtual const aura::Monitor* GetMonitorNearestWindow( 49 virtual const gfx::Monitor& GetMonitorAt(size_t index) OVERRIDE;
50
51 virtual size_t GetNumMonitors() const OVERRIDE;
52 virtual const gfx::Monitor& GetMonitorNearestPoint(
53 const gfx::Point& point) const OVERRIDE;
54 virtual const gfx::Monitor& GetMonitorNearestWindow(
42 const aura::Window* window) const OVERRIDE; 55 const aura::Window* window) const OVERRIDE;
43 virtual const aura::Monitor* GetMonitorNearestPoint(
44 const gfx::Point& point) const OVERRIDE;
45 virtual aura::Monitor* GetMonitorAt(size_t index) OVERRIDE;
46 virtual size_t GetNumMonitors() const OVERRIDE;
47 virtual aura::Monitor* GetMonitorNearestWindow(
48 const aura::Window* window) OVERRIDE;
49 56
50 // RootWindowObserver overrides: 57 // RootWindowObserver overrides:
51 virtual void OnRootWindowResized(const aura::RootWindow* root, 58 virtual void OnRootWindowResized(const aura::RootWindow* root,
52 const gfx::Size& new_size) OVERRIDE; 59 const gfx::Size& new_size) OVERRIDE;
53 60
54 private: 61 private:
55 typedef std::vector<aura::Monitor*> Monitors; 62 typedef std::vector<gfx::Monitor> Monitors;
56 63
57 void Init(); 64 void Init();
58 void AddRemoveMonitorImpl(); 65 void AddRemoveMonitorImpl();
59 void CycleMonitorImpl(); 66 void CycleMonitorImpl();
67 gfx::Monitor& FindMonitorById(int id);
60 68
61 Monitors monitors_; 69 Monitors monitors_;
62 70
63 DISALLOW_COPY_AND_ASSIGN(MultiMonitorManager); 71 DISALLOW_COPY_AND_ASSIGN(MultiMonitorManager);
64 }; 72 };
65 73
66 extern const aura::WindowProperty<aura::Monitor*>* const kMonitorKey; 74 extern const aura::WindowProperty<int>* const kMonitorIdKey;
67 75
68 } // namespace internal 76 } // namespace internal
69 } // namespace ash 77 } // namespace ash
70 78
71 #endif // ASH_MONITOR_MULTI_MONITOR_MANAGER_H_ 79 #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