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

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

Powered by Google App Engine
This is Rietveld 408576698