OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/trace_event/trace_event.h" | |
6 #include "content/browser/renderer_host/input/input_device_change_observer.h" | |
7 | |
8 #if defined(OS_WIN) | |
9 #include "ui/events/devices/input_device_observer_win.h" | |
10 #endif | |
11 | |
12 namespace content { | |
13 | |
14 InputDeviceChangeObserver::InputDeviceChangeObserver(RenderViewHost* rvh) { | |
15 render_view_host_ = rvh; | |
16 #if defined(OS_WIN) | |
17 ui::InputDeviceObserverWin::GetInstance()->AddObserver(this); | |
18 #endif | |
19 } | |
20 | |
21 InputDeviceChangeObserver::~InputDeviceChangeObserver() { | |
22 #if defined(OS_WIN) | |
23 ui::InputDeviceObserverWin::GetInstance()->RemoveObserver(this); | |
24 #endif | |
25 render_view_host_ = nullptr; | |
26 } | |
27 | |
28 void InputDeviceChangeObserver::OnTouchscreenDeviceConfigurationChanged() { | |
29 notifyRenderViewHost(); | |
30 } | |
31 | |
32 void InputDeviceChangeObserver::OnKeyboardDeviceConfigurationChanged() { | |
33 notifyRenderViewHost(); | |
34 } | |
35 | |
36 void InputDeviceChangeObserver::OnMouseDeviceConfigurationChanged() { | |
37 notifyRenderViewHost(); | |
38 } | |
39 | |
40 void InputDeviceChangeObserver::OnTouchpadDeviceConfigurationChanged() { | |
41 notifyRenderViewHost(); | |
42 } | |
43 | |
44 void InputDeviceChangeObserver::notifyRenderViewHost() { | |
jam
2017/04/10 15:01:06
please follow google style guide (i.e NotifyRender
| |
45 if (render_view_host_->InputDeviceFeaturesChanged()) { | |
46 TRACE_EVENT0("input", "InputDeviceChangeObserver::notifyRendererViewHost"); | |
47 render_view_host_->OnWebkitPreferencesChanged(); | |
48 } | |
49 } | |
50 | |
51 } // namespace content | |
OLD | NEW |