OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ash/display/display_change_observer_chromeos.h" | 5 #include "ash/display/display_change_observer_chromeos.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "base/logging.h" | 22 #include "base/logging.h" |
23 #include "grit/ash_strings.h" | 23 #include "grit/ash_strings.h" |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
25 #include "ui/base/user_activity/user_activity_detector.h" | 25 #include "ui/base/user_activity/user_activity_detector.h" |
26 #include "ui/compositor/dip_util.h" | 26 #include "ui/compositor/dip_util.h" |
27 #include "ui/display/display.h" | 27 #include "ui/display/display.h" |
28 #include "ui/display/manager/display_layout.h" | 28 #include "ui/display/manager/display_layout.h" |
29 #include "ui/display/types/display_mode.h" | 29 #include "ui/display/types/display_mode.h" |
30 #include "ui/display/types/display_snapshot.h" | 30 #include "ui/display/types/display_snapshot.h" |
31 #include "ui/display/util/display_util.h" | 31 #include "ui/display/util/display_util.h" |
32 #include "ui/events/devices/device_data_manager.h" | 32 #include "ui/events/devices/input_device_manager.h" |
33 #include "ui/events/devices/touchscreen_device.h" | 33 #include "ui/events/devices/touchscreen_device.h" |
34 | 34 |
35 namespace ash { | 35 namespace ash { |
36 | 36 |
37 using ui::DisplayConfigurator; | 37 using ui::DisplayConfigurator; |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 // The DPI threshold to determine the device scale factor. | 41 // The DPI threshold to determine the device scale factor. |
42 // DPI higher than |dpi| will use |device_scale_factor|. | 42 // DPI higher than |dpi| will use |device_scale_factor|. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 mode.native = false; | 137 mode.native = false; |
138 display_mode_list.push_back(mode); | 138 display_mode_list.push_back(mode); |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 return display_mode_list; | 142 return display_mode_list; |
143 } | 143 } |
144 | 144 |
145 DisplayChangeObserver::DisplayChangeObserver() { | 145 DisplayChangeObserver::DisplayChangeObserver() { |
146 Shell::GetInstance()->AddShellObserver(this); | 146 Shell::GetInstance()->AddShellObserver(this); |
147 ui::DeviceDataManager::GetInstance()->AddObserver(this); | 147 ui::InputDeviceManager::GetInstance()->AddObserver(this); |
148 } | 148 } |
149 | 149 |
150 DisplayChangeObserver::~DisplayChangeObserver() { | 150 DisplayChangeObserver::~DisplayChangeObserver() { |
151 ui::DeviceDataManager::GetInstance()->RemoveObserver(this); | 151 ui::InputDeviceManager::GetInstance()->RemoveObserver(this); |
152 Shell::GetInstance()->RemoveShellObserver(this); | 152 Shell::GetInstance()->RemoveShellObserver(this); |
153 } | 153 } |
154 | 154 |
155 ui::MultipleDisplayState DisplayChangeObserver::GetStateForDisplayIds( | 155 ui::MultipleDisplayState DisplayChangeObserver::GetStateForDisplayIds( |
156 const ui::DisplayConfigurator::DisplayStateList& display_states) const { | 156 const ui::DisplayConfigurator::DisplayStateList& display_states) const { |
157 UpdateInternalDisplayId(display_states); | 157 UpdateInternalDisplayId(display_states); |
158 if (display_states.size() == 1) | 158 if (display_states.size() == 1) |
159 return ui::MULTIPLE_DISPLAY_STATE_SINGLE; | 159 return ui::MULTIPLE_DISPLAY_STATE_SINGLE; |
160 display::DisplayIdList list = | 160 display::DisplayIdList list = |
161 GenerateDisplayIdList(display_states.begin(), display_states.end(), | 161 GenerateDisplayIdList(display_states.begin(), display_states.end(), |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 new_info.SetDisplayModes(display_modes); | 262 new_info.SetDisplayModes(display_modes); |
263 | 263 |
264 new_info.set_available_color_profiles( | 264 new_info.set_available_color_profiles( |
265 Shell::GetInstance() | 265 Shell::GetInstance() |
266 ->display_configurator() | 266 ->display_configurator() |
267 ->GetAvailableColorCalibrationProfiles(id)); | 267 ->GetAvailableColorCalibrationProfiles(id)); |
268 new_info.set_maximum_cursor_size(state->maximum_cursor_size()); | 268 new_info.set_maximum_cursor_size(state->maximum_cursor_size()); |
269 } | 269 } |
270 | 270 |
271 AssociateTouchscreens( | 271 AssociateTouchscreens( |
272 &displays, ui::DeviceDataManager::GetInstance()->touchscreen_devices()); | 272 &displays, |
| 273 ui::InputDeviceManager::GetInstance()->GetTouchscreenDevices()); |
273 // DisplayManager can be null during the boot. | 274 // DisplayManager can be null during the boot. |
274 Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays); | 275 Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays); |
275 | 276 |
276 // For the purposes of user activity detection, ignore synthetic mouse events | 277 // For the purposes of user activity detection, ignore synthetic mouse events |
277 // that are triggered by screen resizes: http://crbug.com/360634 | 278 // that are triggered by screen resizes: http://crbug.com/360634 |
278 ui::UserActivityDetector* user_activity_detector = | 279 ui::UserActivityDetector* user_activity_detector = |
279 ui::UserActivityDetector::Get(); | 280 ui::UserActivityDetector::Get(); |
280 if (user_activity_detector) | 281 if (user_activity_detector) |
281 user_activity_detector->OnDisplayPowerChanging(); | 282 user_activity_detector->OnDisplayPowerChanging(); |
282 } | 283 } |
(...skipping 22 matching lines...) Expand all Loading... |
305 } | 306 } |
306 return 1.0f; | 307 return 1.0f; |
307 } | 308 } |
308 | 309 |
309 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() { | 310 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() { |
310 OnDisplayModeChanged( | 311 OnDisplayModeChanged( |
311 Shell::GetInstance()->display_configurator()->cached_displays()); | 312 Shell::GetInstance()->display_configurator()->cached_displays()); |
312 } | 313 } |
313 | 314 |
314 } // namespace ash | 315 } // namespace ash |
OLD | NEW |