| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "content/browser/renderer_host/input/input_device_change_observer.h" | 5 #include "content/browser/renderer_host/input/input_device_change_observer.h" |
| 6 #include "base/trace_event/trace_event.h" | 6 #include "base/trace_event/trace_event.h" |
| 7 #include "content/public/common/web_preferences.h" | 7 #include "content/public/common/web_preferences.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include "ui/events/devices/input_device_observer_win.h" | 10 #include "ui/events/devices/input_device_observer_win.h" |
| 11 #elif defined(OS_LINUX) |
| 12 #include "ui/events/devices/device_data_manager.h" |
| 11 #endif | 13 #endif |
| 12 | 14 |
| 13 namespace content { | 15 namespace content { |
| 14 | 16 |
| 15 InputDeviceChangeObserver::InputDeviceChangeObserver(RenderViewHost* rvh) { | 17 InputDeviceChangeObserver::InputDeviceChangeObserver(RenderViewHost* rvh) { |
| 16 render_view_host_ = rvh; | 18 render_view_host_ = rvh; |
| 17 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 18 ui::InputDeviceObserverWin::GetInstance()->AddObserver(this); | 20 ui::InputDeviceObserverWin::GetInstance()->AddObserver(this); |
| 21 #elif defined(OS_LINUX) |
| 22 ui::DeviceDataManager::GetInstance()->AddObserver(this); |
| 19 #endif | 23 #endif |
| 20 } | 24 } |
| 21 | 25 |
| 22 InputDeviceChangeObserver::~InputDeviceChangeObserver() { | 26 InputDeviceChangeObserver::~InputDeviceChangeObserver() { |
| 23 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 24 ui::InputDeviceObserverWin::GetInstance()->RemoveObserver(this); | 28 ui::InputDeviceObserverWin::GetInstance()->RemoveObserver(this); |
| 29 #elif defined(OS_LINUX) |
| 30 ui::DeviceDataManager::GetInstance()->RemoveObserver(this); |
| 25 #endif | 31 #endif |
| 26 render_view_host_ = nullptr; | 32 render_view_host_ = nullptr; |
| 27 } | 33 } |
| 28 | 34 |
| 29 void InputDeviceChangeObserver::OnTouchscreenDeviceConfigurationChanged() { | 35 void InputDeviceChangeObserver::OnTouchscreenDeviceConfigurationChanged() { |
| 30 NotifyRenderViewHost(); | 36 NotifyRenderViewHost(); |
| 31 } | 37 } |
| 32 | 38 |
| 33 void InputDeviceChangeObserver::OnKeyboardDeviceConfigurationChanged() { | 39 void InputDeviceChangeObserver::OnKeyboardDeviceConfigurationChanged() { |
| 34 NotifyRenderViewHost(); | 40 NotifyRenderViewHost(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 51 prefs.available_pointer_types != available_pointer_types || | 57 prefs.available_pointer_types != available_pointer_types || |
| 52 prefs.available_hover_types != available_hover_types; | 58 prefs.available_hover_types != available_hover_types; |
| 53 | 59 |
| 54 if (input_device_changed) { | 60 if (input_device_changed) { |
| 55 TRACE_EVENT0("input", "InputDeviceChangeObserver::NotifyRendererViewHost"); | 61 TRACE_EVENT0("input", "InputDeviceChangeObserver::NotifyRendererViewHost"); |
| 56 render_view_host_->OnWebkitPreferencesChanged(); | 62 render_view_host_->OnWebkitPreferencesChanged(); |
| 57 } | 63 } |
| 58 } | 64 } |
| 59 | 65 |
| 60 } // namespace content | 66 } // namespace content |
| OLD | NEW |