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

Side by Side Diff: content/browser/device_monitor_udev.cc

Issue 674703002: Linux: Dynamically load libudev. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scoped_udev
Patch Set: rebase to head, which includes third_party/libudev already Created 6 years, 1 month 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 // libudev is used for monitoring device changes. 5 // libudev is used for monitoring device changes.
6 6
7 #include "content/browser/device_monitor_udev.h" 7 #include "content/browser/device_monitor_udev.h"
8 8
9 #include <libudev.h>
10
11 #include <string> 9 #include <string>
12 10
13 #include "base/system_monitor/system_monitor.h" 11 #include "base/system_monitor/system_monitor.h"
14 #include "content/browser/udev_linux.h" 12 #include "content/browser/udev_linux.h"
15 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "device/udev_linux/udev.h"
16 15
17 namespace { 16 namespace {
18 17
19 struct SubsystemMap { 18 struct SubsystemMap {
20 base::SystemMonitor::DeviceType device_type; 19 base::SystemMonitor::DeviceType device_type;
21 const char* subsystem; 20 const char* subsystem;
22 const char* devtype; 21 const char* devtype;
23 }; 22 };
24 23
25 const char kAudioSubsystem[] = "sound"; 24 const char kAudioSubsystem[] = "sound";
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // Called on IO thread. 64 // Called on IO thread.
66 udev_.reset(); 65 udev_.reset();
67 } 66 }
68 67
69 void DeviceMonitorLinux::OnDevicesChanged(udev_device* device) { 68 void DeviceMonitorLinux::OnDevicesChanged(udev_device* device) {
70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
71 DCHECK(device); 70 DCHECK(device);
72 71
73 base::SystemMonitor::DeviceType device_type = 72 base::SystemMonitor::DeviceType device_type =
74 base::SystemMonitor::DEVTYPE_UNKNOWN; 73 base::SystemMonitor::DEVTYPE_UNKNOWN;
75 std::string subsystem(udev_device_get_subsystem(device)); 74 std::string subsystem(device::udev_device_get_subsystem(device));
76 for (size_t i = 0; i < arraysize(kSubsystemMap); ++i) { 75 for (size_t i = 0; i < arraysize(kSubsystemMap); ++i) {
77 if (subsystem == kSubsystemMap[i].subsystem) { 76 if (subsystem == kSubsystemMap[i].subsystem) {
78 device_type = kSubsystemMap[i].device_type; 77 device_type = kSubsystemMap[i].device_type;
79 break; 78 break;
80 } 79 }
81 } 80 }
82 DCHECK_NE(device_type, base::SystemMonitor::DEVTYPE_UNKNOWN); 81 DCHECK_NE(device_type, base::SystemMonitor::DEVTYPE_UNKNOWN);
83 82
84 base::SystemMonitor::Get()->ProcessDevicesChanged(device_type); 83 base::SystemMonitor::Get()->ProcessDevicesChanged(device_type);
85 } 84 }
86 85
87 } // namespace content 86 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/gamepad/gamepad_platform_data_fetcher_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698