OLD | NEW |
---|---|
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> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 24 matching lines...) Expand all Loading... | |
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 monitor from string spec. 100+200-1440x800 creates monitor |
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 // monitor at the origin of the screen. An empty string creates |
44 // the monitor with default size. | 44 // the monitor with default size. |
45 static gfx::Monitor CreateMonitorFromSpec(const std::string& spec); | 45 // The device scale factor can be specifeid by "*", like "1280x780*2", |
46 // or |default_device_scale_factor| will be used if omitted. | |
47 static gfx::Monitor CreateMonitorFromSpec( | |
sadrul
2012/04/30 15:15:49
It would be very nice to remove the '*' bit from t
oshima
2012/04/30 17:25:25
This allow us to test multi densities environment,
| |
48 float default_device_scale_factor, const std::string& spec); | |
46 | 49 |
47 // A utility function to create a root window for primary monitor. | 50 // A utility function to create a root window for primary monitor. |
48 static RootWindow* CreateRootWindowForPrimaryMonitor(); | 51 static RootWindow* CreateRootWindowForPrimaryMonitor(); |
49 | 52 |
50 MonitorManager(); | 53 MonitorManager(); |
51 virtual ~MonitorManager(); | 54 virtual ~MonitorManager(); |
52 | 55 |
56 float default_device_scale_factor() const { | |
57 return default_device_scale_factor_; | |
58 } | |
59 | |
53 // Adds/removes MonitorObservers. | 60 // Adds/removes MonitorObservers. |
54 void AddObserver(MonitorObserver* observer); | 61 void AddObserver(MonitorObserver* observer); |
55 void RemoveObserver(MonitorObserver* observer); | 62 void RemoveObserver(MonitorObserver* observer); |
56 | 63 |
57 // Called when monitor configuration has changed. The new monitor | 64 // Called when monitor configuration has changed. The new monitor |
58 // configurations is passed as a vector of Monitor object, which | 65 // configurations is passed as a vector of Monitor object, which |
59 // contains each monitor's new infomration. | 66 // contains each monitor's new infomration. |
60 virtual void OnNativeMonitorsChanged( | 67 virtual void OnNativeMonitorsChanged( |
61 const std::vector<gfx::Monitor>& monitors) = 0; | 68 const std::vector<gfx::Monitor>& monitors) = 0; |
62 | 69 |
(...skipping 21 matching lines...) Expand all Loading... | |
84 void NotifyMonitorAdded(const gfx::Monitor& monitor); | 91 void NotifyMonitorAdded(const gfx::Monitor& monitor); |
85 void NotifyMonitorRemoved(const gfx::Monitor& monitor); | 92 void NotifyMonitorRemoved(const gfx::Monitor& monitor); |
86 | 93 |
87 private: | 94 private: |
88 // If set before the RootWindow is created, the host window will cover the | 95 // If set before the RootWindow is created, the host window will cover the |
89 // entire monitor. Note that this can still be overridden via the | 96 // entire monitor. Note that this can still be overridden via the |
90 // switches::kAuraHostWindowSize flag. | 97 // switches::kAuraHostWindowSize flag. |
91 static bool use_fullscreen_host_window_; | 98 static bool use_fullscreen_host_window_; |
92 | 99 |
93 ObserverList<MonitorObserver> observers_; | 100 ObserverList<MonitorObserver> observers_; |
101 | |
102 float default_device_scale_factor_; | |
94 DISALLOW_COPY_AND_ASSIGN(MonitorManager); | 103 DISALLOW_COPY_AND_ASSIGN(MonitorManager); |
95 }; | 104 }; |
96 | 105 |
97 } // namespace aura | 106 } // namespace aura |
98 | 107 |
99 #endif // UI_AURA_MONITOR_MANAGER_H_ | 108 #endif // UI_AURA_MONITOR_MANAGER_H_ |
OLD | NEW |