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

Side by Side Diff: content/browser/renderer_host/input/input_device_change_observer.cc

Issue 2690323002: Make Interaction Media Features MQ dynamic on Windows. (Closed)
Patch Set: Added Trace Created 3 years, 8 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
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698