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

Side by Side Diff: ash/display/display_change_observer_chromeos.cc

Issue 618283003: Adds special support to the device manager for keyboards devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update device list on disable/enable. Created 6 years, 2 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
OLDNEW
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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 268
267 // static 269 // static
268 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { 270 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) {
269 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) { 271 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) {
270 if (dpi > kThresholdTable[i].dpi) 272 if (dpi > kThresholdTable[i].dpi)
271 return kThresholdTable[i].device_scale_factor; 273 return kThresholdTable[i].device_scale_factor;
272 } 274 }
273 return 1.0f; 275 return 1.0f;
274 } 276 }
275 277
276 void DisplayChangeObserver::OnInputDeviceConfigurationChanged() { 278 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() {
277 std::vector<DisplayInfo> display_infos; 279 std::vector<DisplayInfo> display_infos;
278 DisplayManager* display_manager = 280 DisplayManager* display_manager =
279 ash::Shell::GetInstance()->display_manager(); 281 ash::Shell::GetInstance()->display_manager();
280 const std::vector<gfx::Display>& displays = display_manager->displays(); 282 const std::vector<gfx::Display>& displays = display_manager->displays();
281 // Reuse the current state in DisplayManager and re-associate the displays 283 // Reuse the current state in DisplayManager and re-associate the displays
282 // with the touchscreens. 284 // with the touchscreens.
283 for (size_t i = 0; i < displays.size(); ++i) { 285 for (size_t i = 0; i < displays.size(); ++i) {
284 DisplayInfo display = display_manager->GetDisplayInfo(displays[i].id()); 286 DisplayInfo display = display_manager->GetDisplayInfo(displays[i].id());
285 // Unset the touchscreen configuration since we'll be rematching them from 287 // Unset the touchscreen configuration since we'll be rematching them from
286 // scratch. 288 // scratch.
287 display.set_touch_device_id(ui::TouchscreenDevice::kInvalidId); 289 display.set_touch_device_id(ui::TouchscreenDevice::kInvalidId);
288 display.set_touch_support(gfx::Display::TOUCH_SUPPORT_UNKNOWN); 290 display.set_touch_support(gfx::Display::TOUCH_SUPPORT_UNKNOWN);
289 291
290 display_infos.push_back(display); 292 display_infos.push_back(display);
291 } 293 }
292 294
293 AssociateTouchscreens( 295 AssociateTouchscreens(
294 &display_infos, 296 &display_infos,
295 ui::DeviceDataManager::GetInstance()->touchscreen_devices()); 297 ui::DeviceDataManager::GetInstance()->touchscreen_devices());
296 display_manager->OnNativeDisplaysChanged(display_infos); 298 display_manager->OnNativeDisplaysChanged(display_infos);
297 } 299 }
298 300
301 void DisplayChangeObserver::OnKeyboardDeviceConfigurationChanged() {}
302
299 } // namespace ash 303 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698