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

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: Rebased Created 3 years, 9 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 "content/browser/renderer_host/input/input_device_change_observer.h"
6
7 #if defined(OS_WIN)
8 #include "ui/events/devices/input_device_observer_win.h"
9 #endif
10
11 namespace content {
12
13 InputDeviceChangeObserver::InputDeviceChangeObserver(RenderViewHost* rvh) {
14 render_view_host_ = rvh;
15 #if defined(OS_WIN)
16 ui::InputDeviceObserverWin::GetInstance()->AddObserver(this);
17 #endif
18 }
19
20 InputDeviceChangeObserver::~InputDeviceChangeObserver() {
21 #if defined(OS_WIN)
22 ui::InputDeviceObserverWin::GetInstance()->RemoveObserver(this);
23 #endif
24 render_view_host_ = nullptr;
25 }
26
27 void InputDeviceChangeObserver::OnTouchscreenDeviceConfigurationChanged() {
28 notifyRenderViewHost();
29 }
30
31 void InputDeviceChangeObserver::OnKeyboardDeviceConfigurationChanged() {
32 notifyRenderViewHost();
33 }
34
35 void InputDeviceChangeObserver::OnMouseDeviceConfigurationChanged() {
36 notifyRenderViewHost();
37 }
38
39 void InputDeviceChangeObserver::OnTouchpadDeviceConfigurationChanged() {
40 notifyRenderViewHost();
41 }
42
43 void InputDeviceChangeObserver::notifyRenderViewHost() {
44 if (render_view_host_->InputDeviceFeaturesChanged())
45 render_view_host_->OnWebkitPreferencesChanged();
46 }
47
48 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698