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

Side by Side Diff: ui/aura/monitor_manager.h

Issue 9701098: MultiMonitor support (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
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 UI_AURA_MONITOR_MANAGER_H_ 5 #ifndef UI_AURA_MONITOR_MANAGER_H_
6 #define UI_AURA_MONITOR_MANAGER_H_ 6 #define UI_AURA_MONITOR_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string>
10
9 #include "base/basictypes.h" 11 #include "base/basictypes.h"
10 #include "base/observer_list.h" 12 #include "base/observer_list.h"
11 #include "ui/aura/aura_export.h" 13 #include "ui/aura/aura_export.h"
12 14
13 namespace gfx { 15 namespace gfx {
14 class Point; 16 class Point;
15 class Size; 17 class Size;
16 } 18 }
17 19
18 namespace aura { 20 namespace aura {
(...skipping 10 matching lines...) Expand all
29 31
30 // MonitorManager creates, deletes and updates Monitor objects when 32 // MonitorManager creates, deletes and updates Monitor objects when
31 // monitor configuration changes, and notifies MonitorObservers about 33 // monitor configuration changes, and notifies MonitorObservers about
32 // the change. This is owned by Env and its lifetime is longer than 34 // the change. This is owned by Env and its lifetime is longer than
33 // any windows. 35 // any windows.
34 class AURA_EXPORT MonitorManager { 36 class AURA_EXPORT MonitorManager {
35 public: 37 public:
36 MonitorManager(); 38 MonitorManager();
37 virtual ~MonitorManager(); 39 virtual ~MonitorManager();
38 40
41 static void set_use_fullscreen_host_window(bool use_fullscreen) {
42 use_fullscreen_host_window_ = use_fullscreen;
43 }
44 static bool use_fullscreen_host_window() {
45 return use_fullscreen_host_window_;
46 }
47
48 // Creates a monitor from string spec. 100+200-1440x800 creates monitor
49 // whose size is 1440x800 at the location (100, 200) in screen's coordinates.
50 // The location can be omitted and be just "1440x800", which creates
51 // monitor at the origin of the screen. An empty string creates
52 // the monitor with default size.
53 static Monitor* CreateMonitorFromSpec(const std::string& spec);
54
39 // Adds/removes MonitorObservers. 55 // Adds/removes MonitorObservers.
40 void AddObserver(MonitorObserver* observer); 56 void AddObserver(MonitorObserver* observer);
41 void RemoveObserver(MonitorObserver* observer); 57 void RemoveObserver(MonitorObserver* observer);
42 58
43 // Called when native window's monitor size has changed. 59 // Called when native window's monitor size has changed.
44 // TODO(oshima): multiple monitor support. 60 // TODO(oshima): multiple monitor support.
45 virtual void OnNativeMonitorResized(const gfx::Size& size) = 0; 61 virtual void OnNativeMonitorResized(const gfx::Size& size) = 0;
46 62
47 // Create a root window for primary monitor. 63 // Create a root window for primary monitor.
48 virtual RootWindow* CreateRootWindowForMonitor(const Monitor* monitor) = 0; 64 virtual RootWindow* CreateRootWindowForMonitor(Monitor* monitor) = 0;
49 65
50 // Returns the monitor object nearest given |window|. 66 // Returns the monitor object nearest given |window|.
51 virtual const Monitor* GetMonitorNearestWindow( 67 virtual const Monitor* GetMonitorNearestWindow(
52 const Window* window) const = 0; 68 const Window* window) const = 0;
53 virtual Monitor* GetMonitorNearestWindow(const Window* window) = 0; 69 virtual Monitor* GetMonitorNearestWindow(const Window* window) = 0;
54 70
55 // Returns the monitor object nearest given |pint|. 71 // Returns the monitor object nearest given |pint|.
56 virtual const Monitor* GetMonitorNearestPoint( 72 virtual const Monitor* GetMonitorNearestPoint(
57 const gfx::Point& point) const = 0; 73 const gfx::Point& point) const = 0;
58 74
59 // Returns the monitor that is consiered "primary". 75 // Returns the monitor at |index|. The monitor at 0 is consiered
60 virtual const Monitor* GetPrimaryMonitor() const = 0; 76 // "primary".
77 virtual Monitor* GetMonitorAt(size_t index) = 0;
61 78
62 virtual size_t GetNumMonitors() const = 0; 79 virtual size_t GetNumMonitors() const = 0;
63 80
64 // A utility function to create a root window for primary monitor. 81 // A utility function to create a root window for primary monitor.
65 RootWindow* CreateRootWindowForPrimaryMonitor(); 82 RootWindow* CreateRootWindowForPrimaryMonitor();
66 83
67 protected: 84 protected:
68 // Calls observers' OnMonitorBoundsChanged methods. 85 // Calls observers' OnMonitorBoundsChanged methods.
69 void NotifyBoundsChanged(const Monitor* monitor); 86 void NotifyBoundsChanged(const Monitor* monitor);
70 87
71 private: 88 private:
89 // If set before the RootWindow is created, the host window will cover the
90 // entire monitor. Note that this can still be overridden via the
91 // switches::kAuraHostWindowSize flag.
92 static bool use_fullscreen_host_window_;
93
72 ObserverList<MonitorObserver> observers_; 94 ObserverList<MonitorObserver> observers_;
73
74 DISALLOW_COPY_AND_ASSIGN(MonitorManager); 95 DISALLOW_COPY_AND_ASSIGN(MonitorManager);
75 }; 96 };
76 97
77 } // namespace aura 98 } // namespace aura
78 99
79 #endif // UI_AURA_MONITOR_MANAGER_H_ 100 #endif // UI_AURA_MONITOR_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698