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> |
| 11 #include <utility> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "ash/ash_switches.h" | 14 #include "ash/ash_switches.h" |
13 #include "ash/display/display_info.h" | 15 #include "ash/display/display_info.h" |
14 #include "ash/display/display_layout_store.h" | 16 #include "ash/display/display_layout_store.h" |
15 #include "ash/display/display_manager.h" | 17 #include "ash/display/display_manager.h" |
16 #include "ash/shell.h" | 18 #include "ash/shell.h" |
17 #include "ash/touch/touchscreen_util.h" | 19 #include "ash/touch/touchscreen_util.h" |
18 #include "base/command_line.h" | 20 #include "base/command_line.h" |
19 #include "base/logging.h" | 21 #include "base/logging.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 270 |
269 // static | 271 // static |
270 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { | 272 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { |
271 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) { | 273 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) { |
272 if (dpi > kThresholdTable[i].dpi) | 274 if (dpi > kThresholdTable[i].dpi) |
273 return kThresholdTable[i].device_scale_factor; | 275 return kThresholdTable[i].device_scale_factor; |
274 } | 276 } |
275 return 1.0f; | 277 return 1.0f; |
276 } | 278 } |
277 | 279 |
278 void DisplayChangeObserver::OnInputDeviceConfigurationChanged() { | 280 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() { |
279 std::vector<DisplayInfo> display_infos; | 281 std::vector<DisplayInfo> display_infos; |
280 DisplayManager* display_manager = | 282 DisplayManager* display_manager = |
281 ash::Shell::GetInstance()->display_manager(); | 283 ash::Shell::GetInstance()->display_manager(); |
282 const std::vector<gfx::Display>& displays = display_manager->displays(); | 284 const std::vector<gfx::Display>& displays = display_manager->displays(); |
283 // Reuse the current state in DisplayManager and re-associate the displays | 285 // Reuse the current state in DisplayManager and re-associate the displays |
284 // with the touchscreens. | 286 // with the touchscreens. |
285 for (size_t i = 0; i < displays.size(); ++i) { | 287 for (size_t i = 0; i < displays.size(); ++i) { |
286 DisplayInfo display = display_manager->GetDisplayInfo(displays[i].id()); | 288 DisplayInfo display = display_manager->GetDisplayInfo(displays[i].id()); |
287 // Unset the touchscreen configuration since we'll be rematching them from | 289 // Unset the touchscreen configuration since we'll be rematching them from |
288 // scratch. | 290 // scratch. |
289 display.set_touch_device_id(ui::TouchscreenDevice::kInvalidId); | 291 display.set_touch_device_id(ui::TouchscreenDevice::kInvalidId); |
290 display.set_touch_support(gfx::Display::TOUCH_SUPPORT_UNKNOWN); | 292 display.set_touch_support(gfx::Display::TOUCH_SUPPORT_UNKNOWN); |
291 | 293 |
292 display_infos.push_back(display); | 294 display_infos.push_back(display); |
293 } | 295 } |
294 | 296 |
295 AssociateTouchscreens( | 297 AssociateTouchscreens( |
296 &display_infos, | 298 &display_infos, |
297 ui::DeviceDataManager::GetInstance()->touchscreen_devices()); | 299 ui::DeviceDataManager::GetInstance()->touchscreen_devices()); |
298 display_manager->OnNativeDisplaysChanged(display_infos); | 300 display_manager->OnNativeDisplaysChanged(display_infos); |
299 } | 301 } |
300 | 302 |
| 303 void DisplayChangeObserver::OnKeyboardDeviceConfigurationChanged() {} |
| 304 |
301 } // namespace ash | 305 } // namespace ash |
OLD | NEW |