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

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

Issue 10675011: Rename the remaining usage of Monitor to Display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 5 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 | « ui/aura/monitor_change_observer_x11.cc ('k') | ui/aura/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
(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 UI_AURA_MONITOR_MANAGER_H_
6 #define UI_AURA_MONITOR_MANAGER_H_
7 #pragma once
8
9 #include <string>
10 #include <vector>
11
12 #include "base/basictypes.h"
13 #include "base/observer_list.h"
14 #include "ui/aura/aura_export.h"
15
16 namespace gfx {
17 class Display;
18 class Point;
19 class Size;
20 }
21
22 namespace aura {
23 class DisplayObserver;
24 class RootWindow;
25 class Window;
26
27 // MonitorManager creates, deletes and updates Monitor objects when
28 // monitor configuration changes, and notifies DisplayObservers about
29 // the change. This is owned by Env and its lifetime is longer than
30 // any windows.
31 class AURA_EXPORT MonitorManager {
32 public:
33 static void set_use_fullscreen_host_window(bool use_fullscreen) {
34 use_fullscreen_host_window_ = use_fullscreen;
35 }
36 static bool use_fullscreen_host_window() {
37 return use_fullscreen_host_window_;
38 }
39
40 // Creates a monitor from string spec. 100+200-1440x800 creates monitor
41 // whose size is 1440x800 at the location (100, 200) in screen's coordinates.
42 // The location can be omitted and be just "1440x800", which creates
43 // monitor at the origin of the screen. An empty string creates
44 // the monitor with default size.
45 // The device scale factor can be specified by "*", like "1280x780*2",
46 // or will use the value of |gfx::Display::GetForcedDeviceScaleFactor()| if
47 // --force-device-scale-factor is specified.
48 static gfx::Display CreateMonitorFromSpec(const std::string& spec);
49
50 // A utility function to create a root window for primary monitor.
51 static RootWindow* CreateRootWindowForPrimaryMonitor();
52
53 MonitorManager();
54 virtual ~MonitorManager();
55
56 // Adds/removes DisplayObservers.
57 void AddObserver(DisplayObserver* observer);
58 void RemoveObserver(DisplayObserver* observer);
59
60 // Called when monitor configuration has changed. The new monitor
61 // configurations is passed as a vector of Monitor object, which
62 // contains each monitor's new infomration.
63 virtual void OnNativeMonitorsChanged(
64 const std::vector<gfx::Display>& display) = 0;
65
66 // Create a root window for given |monitor|.
67 virtual RootWindow* CreateRootWindowForMonitor(
68 const gfx::Display& display) = 0;
69
70 // Returns the display at |index|. The display at 0 is considered "primary".
71 virtual const gfx::Display& GetDisplayAt(size_t index) = 0;
72
73 virtual size_t GetNumDisplays() const = 0;
74
75 // Returns the display object nearest given |window|.
76 virtual const gfx::Display& GetDisplayNearestWindow(
77 const Window* window) const = 0;
78
79 // Returns the monitor object nearest given |pint|.
80 virtual const gfx::Display& GetDisplayNearestPoint(
81 const gfx::Point& point) const = 0;
82
83 protected:
84 // Calls observers' OnDisplayBoundsChanged methods.
85 void NotifyBoundsChanged(const gfx::Display& display);
86 void NotifyDisplayAdded(const gfx::Display& display);
87 void NotifyDisplayRemoved(const gfx::Display& display);
88
89 private:
90 // If set before the RootWindow is created, the host window will cover the
91 // entire monitor. Note that this can still be overridden via the
92 // switches::kAuraHostWindowSize flag.
93 static bool use_fullscreen_host_window_;
94
95 ObserverList<DisplayObserver> observers_;
96 DISALLOW_COPY_AND_ASSIGN(MonitorManager);
97 };
98
99 } // namespace aura
100
101 #endif // UI_AURA_MONITOR_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/aura/monitor_change_observer_x11.cc ('k') | ui/aura/monitor_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698