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

Side by Side Diff: chrome/browser/media_gallery/media_device_notifications_linux.cc

Issue 10829228: [LINUX] Extract the name and id of the device and send it along the device attach message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // MediaDeviceNotificationsLinux implementation. 5 // MediaDeviceNotificationsLinux implementation.
6 6
7 #include "chrome/browser/media_gallery/media_device_notifications_linux.h" 7 #include "chrome/browser/media_gallery/media_device_notifications_linux.h"
8 8
9 #include <libudev.h>
9 #include <mntent.h> 10 #include <mntent.h>
10 #include <stdio.h> 11 #include <stdio.h>
11 12
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/bind.h" 15 #include "base/bind.h"
15 #include "base/file_path.h" 16 #include "base/file_path.h"
17 #include "base/metrics/histogram.h"
16 #include "base/stl_util.h" 18 #include "base/stl_util.h"
17 #include "base/string_number_conversions.h" 19 #include "base/string_number_conversions.h"
20 #include "base/string_util.h"
18 #include "base/system_monitor/system_monitor.h" 21 #include "base/system_monitor/system_monitor.h"
19 #include "base/utf_string_conversions.h" 22 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/media_gallery/media_device_notifications_utils.h" 23 #include "chrome/browser/media_gallery/media_device_notifications_utils.h"
21 24
22 namespace { 25 namespace {
23 26
24 // List of file systems we care about. 27 // List of file systems we care about.
25 const char* const kKnownFileSystems[] = { 28 const char* const kKnownFileSystems[] = {
26 "ext2", 29 "ext2",
27 "ext3", 30 "ext3",
28 "ext4", 31 "ext4",
29 "fat", 32 "fat",
30 "hfsplus", 33 "hfsplus",
31 "iso9660", 34 "iso9660",
32 "msdos", 35 "msdos",
33 "ntfs", 36 "ntfs",
34 "udf", 37 "udf",
35 "vfat", 38 "vfat",
36 }; 39 };
37 40
41 // Device property constants.
42 const char kDevName[] = "DEVNAME";
43 const char kFsUUID[] = "ID_FS_UUID";
44 const char kLabel[] = "ID_FS_LABEL";
45 const char kModel[] = "ID_MODEL";
46 const char kModelID[] = "ID_MODEL_ID";
47 const char kSeperator[] = "_";
48 const char kSerial[] = "ID_SERIAL";
49 const char kSerialShort[] = "ID_SERIAL_SHORT";
50 const char kVendor[] = "ID_VENDOR";
51 const char kVendorID[] = "ID_VENDOR_ID";
52
53 // Get the device information using udev library.
54 // Returns true on success, false on failure.
55 bool GetDeviceInfoHelper(const std::string& dev_path,
vandebo (ex-Chrome) 2012/08/09 17:52:35 nit: device_path
kmadhusu 2012/08/09 23:41:29 Done.
56 std::string* id,
57 string16* name) {
58 DCHECK(!dev_path.empty());
59
60 // libudev-related items.
vandebo (ex-Chrome) 2012/08/09 17:52:35 remove comment (what, not why)
kmadhusu 2012/08/09 23:41:29 Done.
61 udev* udev_ptr = udev_new();
vandebo (ex-Chrome) 2012/08/09 17:52:35 This should be a scoped object. If there isn't al
kmadhusu 2012/08/09 23:41:29 Done. Thanks for pointing out ScopedGenericObj.
62 CHECK(udev_ptr);
63
64 // Get device file status.
vandebo (ex-Chrome) 2012/08/09 17:52:35 remove comment
kmadhusu 2012/08/09 23:41:29 Done.
65 struct stat st;
66 if (stat(dev_path.c_str(), &st) < 0) {
67 udev_unref(udev_ptr);
68 return false;
69 }
70
71 // Identify the device type.
vandebo (ex-Chrome) 2012/08/09 17:52:35 remove comment
kmadhusu 2012/08/09 23:41:29 Done.
72 char dev_type;
vandebo (ex-Chrome) 2012/08/09 17:52:35 nit: consistent naming -> device_type
kmadhusu 2012/08/09 23:41:29 Done.
73 if (S_ISCHR(st.st_mode))
74 dev_type = 'c';
75 else if (S_ISBLK(st.st_mode))
76 dev_type = 'b';
77 else
78 return false; // Not a supported type.
79
80 // Create a new udev_device object from device ID.
vandebo (ex-Chrome) 2012/08/09 17:52:35 remove comment
kmadhusu 2012/08/09 23:41:29 Done.
81 udev_device* device = udev_device_new_from_devnum(udev_ptr, dev_type,
vandebo (ex-Chrome) 2012/08/09 17:52:35 Same here
kmadhusu 2012/08/09 23:41:29 Done.
82 st.st_rdev);
83 if (!device) {
84 udev_unref(udev_ptr);
85 return false;
86 }
87
88 // Construct a device name using label or manufacturer(vendor and model)
vandebo (ex-Chrome) 2012/08/09 17:52:35 Name should be something that helps the user under
kmadhusu 2012/08/09 23:41:29 Label, Serial, Vendor and Model properties return
89 // details.
90 std::string device_name;
91 const char* dev_name = NULL;
vandebo (ex-Chrome) 2012/08/09 17:52:35 nit: device_name
kmadhusu 2012/08/09 23:41:29 Done.
92 if ((dev_name = udev_device_get_property_value(device, kLabel)) ||
93 (dev_name = udev_device_get_property_value(device, kSerial))) {
vandebo (ex-Chrome) 2012/08/09 17:52:35 what are the ownership semantics of udev_device_ge
kmadhusu 2012/08/10 19:41:01 I ran Chromium under ASAN and I did not find any m
94 device_name = dev_name;
95 } else {
96 // Format: VendorInfo_ModelInfo
97 // Eg: KnCompany_Model2010
vandebo (ex-Chrome) 2012/08/09 17:52:35 why an underscore? name is for presentation to hu
kmadhusu 2012/08/09 23:41:29 No specific reason to use underscore. As we discus
98 const char *vendor_name = NULL, *model_name = NULL;
99 if ((vendor_name = udev_device_get_property_value(device, kVendor)))
100 device_name = vendor_name;
101 if ((model_name = udev_device_get_property_value(device, kModel))) {
102 if (!device_name.empty())
103 device_name += kSeperator;
104 device_name += model_name;
105 }
106 }
107 *name = UTF8ToUTF16(device_name);
108
109 // Construct a unique id using fs uuid or manufacturer(vendor and model)
110 // details.
vandebo (ex-Chrome) 2012/08/09 17:52:35 We'll eventually want to have a function that give
kmadhusu 2012/08/09 23:41:29 Done.
111 const char* uuid = NULL;
112 if ((uuid = udev_device_get_property_value(device, kFsUUID))) {
113 *id = uuid;
114 } else {
115 // Format: VendorInfo_ModelInfo_SerialShortInfo
116 // Eg: Kn_DataTravel_12.10_8000000000006CB02CDB
117 const char *vendor = NULL, *model = NULL, *serial_short = NULL;
118 if ((vendor = udev_device_get_property_value(device, kVendorID)))
119 *id = vendor;
120
121 if ((model = udev_device_get_property_value(device, kModelID))) {
122 if (!id->empty())
123 *id += kSeperator;
124 *id += model;
125 }
126 if ((serial_short = udev_device_get_property_value(device, kSerialShort))) {
127 if (!id->empty())
128 *id += kSeperator;
129 *id += serial_short;
130 }
131 }
132
133 udev_unref(udev_ptr);
134 udev_device_unref(device);
135 return true;
136 }
137
38 } // namespace 138 } // namespace
39 139
40 namespace chrome { 140 namespace chrome {
41 141
42 using base::SystemMonitor; 142 using base::SystemMonitor;
43 using content::BrowserThread; 143 using content::BrowserThread;
44 144
45 MediaDeviceNotificationsLinux::MediaDeviceNotificationsLinux( 145 MediaDeviceNotificationsLinux::MediaDeviceNotificationsLinux(
46 const FilePath& path) 146 const FilePath& path)
47 : initialized_(false), 147 : initialized_(false),
48 mtab_path_(path), 148 mtab_path_(path) {
49 current_device_id_(0U) {
50 CHECK(!path.empty()); 149 CHECK(!path.empty());
51 150
52 // Put |kKnownFileSystems| in std::set to get O(log N) access time. 151 // Put |kKnownFileSystems| in std::set to get O(log N) access time.
53 for (size_t i = 0; i < arraysize(kKnownFileSystems); ++i) { 152 for (size_t i = 0; i < arraysize(kKnownFileSystems); ++i) {
54 known_file_systems_.insert(kKnownFileSystems[i]); 153 known_file_systems_.insert(kKnownFileSystems[i]);
55 } 154 }
56 } 155 }
57 156
58 MediaDeviceNotificationsLinux::~MediaDeviceNotificationsLinux() { 157 MediaDeviceNotificationsLinux::~MediaDeviceNotificationsLinux() {
59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
(...skipping 14 matching lines...) Expand all
74 return; 173 return;
75 } 174 }
76 if (error) { 175 if (error) {
77 LOG(ERROR) << "Error watching " << mtab_path_.value(); 176 LOG(ERROR) << "Error watching " << mtab_path_.value();
78 return; 177 return;
79 } 178 }
80 179
81 UpdateMtab(); 180 UpdateMtab();
82 } 181 }
83 182
183 bool MediaDeviceNotificationsLinux::GetDeviceInfo(const std::string& dev_path,
184 std::string* id,
185 string16* name) {
186 return GetDeviceInfoHelper(dev_path, id, name);
187 }
188
84 void MediaDeviceNotificationsLinux::InitOnFileThread() { 189 void MediaDeviceNotificationsLinux::InitOnFileThread() {
85 DCHECK(!initialized_); 190 DCHECK(!initialized_);
86 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
87 initialized_ = true; 192 initialized_ = true;
88 193
89 // The callback passed to Watch() has to be unretained. Otherwise 194 // The callback passed to Watch() has to be unretained. Otherwise
90 // MediaDeviceNotificationsLinux will live longer than expected, and 195 // MediaDeviceNotificationsLinux will live longer than expected, and
91 // FilePathWatcher will get in trouble at shutdown time. 196 // FilePathWatcher will get in trouble at shutdown time.
92 bool ret = file_watcher_.Watch( 197 bool ret = file_watcher_.Watch(
93 mtab_path_, 198 mtab_path_,
94 base::Bind(&MediaDeviceNotificationsLinux::OnFilePathChanged, 199 base::Bind(&MediaDeviceNotificationsLinux::OnFilePathChanged,
95 base::Unretained(this))); 200 base::Unretained(this)));
96 if (!ret) { 201 if (!ret) {
97 LOG(ERROR) << "Adding watch for " << mtab_path_.value() << " failed"; 202 LOG(ERROR) << "Adding watch for " << mtab_path_.value() << " failed";
98 return; 203 return;
99 } 204 }
100 205
101 UpdateMtab(); 206 UpdateMtab();
102 } 207 }
103 208
104 void MediaDeviceNotificationsLinux::UpdateMtab() { 209 void MediaDeviceNotificationsLinux::UpdateMtab() {
105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
106 211
107 MountMap new_mtab; 212 MountPointDeviceMap new_mtab;
108 ReadMtab(&new_mtab); 213 ReadMtab(&new_mtab);
109 214
110 // Check existing mtab entries for unaccounted mount points. 215 // Check existing mtab entries for unaccounted mount points.
111 // These mount points must have been removed in the new mtab. 216 // These mount points must have been removed in the new mtab.
112 std::vector<std::string> mount_points_to_erase; 217 std::vector<std::string> mount_points_to_erase;
113 for (MountMap::const_iterator it = mtab_.begin(); it != mtab_.end(); ++it) { 218 for (MountMap::const_iterator it = mtab_.begin(); it != mtab_.end(); ++it) {
114 const std::string& mount_point = it->first; 219 const std::string& mount_point = it->first;
115 // |mount_point| not in |new_mtab|. 220 const std::string& mount_device = it->second.first;
116 if (!ContainsKey(new_mtab, mount_point)) { 221 MountPointDeviceMap::iterator newiter = new_mtab.find(mount_point);
222 // |mount_point| not in |new_mtab| or |mount_device| is no longer mounted at
223 // |mount_point|.
224 if (newiter == new_mtab.end() ||
225 base::strcasecmp(newiter->second.c_str(), mount_device.c_str()) != 0) {
kmadhusu 2012/08/09 08:10:03 When I use "==", the unit tests are failing. So, I
vandebo (ex-Chrome) 2012/08/09 17:52:35 case should be consistent, so lets understand what
kmadhusu 2012/08/09 23:41:29 I made a silly mistake in patch 6 that made the te
117 const std::string& device_id = it->second.second; 226 const std::string& device_id = it->second.second;
118 RemoveOldDevice(device_id); 227 RemoveOldDevice(device_id);
119 mount_points_to_erase.push_back(mount_point); 228 mount_points_to_erase.push_back(mount_point);
120 } 229 }
121 } 230 }
122 // Erase the |mtab_| entries afterwards. Erasing in the loop above using the 231 // Erase the |mtab_| entries afterwards. Erasing in the loop above using the
123 // iterator is slightly more efficient, but more tricky, since calling 232 // iterator is slightly more efficient, but more tricky, since calling
124 // std::map::erase() on an iterator invalidates it. 233 // std::map::erase() on an iterator invalidates it.
125 for (size_t i = 0; i < mount_points_to_erase.size(); ++i) 234 for (size_t i = 0; i < mount_points_to_erase.size(); ++i)
126 mtab_.erase(mount_points_to_erase[i]); 235 mtab_.erase(mount_points_to_erase[i]);
127 236
128 // Check new mtab entries against existing ones. 237 // Check new mtab entries against existing ones.
129 for (MountMap::iterator newiter = new_mtab.begin(); 238 for (MountPointDeviceMap::iterator newiter = new_mtab.begin();
130 newiter != new_mtab.end(); 239 newiter != new_mtab.end();
131 ++newiter) { 240 ++newiter) {
241 std::string device_id;
vandebo (ex-Chrome) 2012/08/09 17:52:35 Move this to just before line 248 and just before
kmadhusu 2012/08/09 23:41:29 Done.
132 const std::string& mount_point = newiter->first; 242 const std::string& mount_point = newiter->first;
133 const MountDeviceAndId& mount_device_and_id = newiter->second; 243 const std::string& mount_device = newiter->second;
134 const std::string& mount_device = mount_device_and_id.first;
135 std::string& id = newiter->second.second;
136 MountMap::iterator olditer = mtab_.find(mount_point); 244 MountMap::iterator olditer = mtab_.find(mount_point);
137 // Check to see if it is a new mount point. 245 // Check to see if it is a new mount point.
138 if (olditer == mtab_.end()) { 246 if (olditer == mtab_.end()) {
139 if (IsMediaDevice(mount_point)) { 247 if (IsMediaDevice(mount_point)) {
140 AddNewDevice(mount_device, mount_point, &id); 248 AddNewDevice(mount_device, mount_point, &device_id);
vandebo (ex-Chrome) 2012/08/09 17:52:35 Seems like AddNewDevice should be responsible for
kmadhusu 2012/08/09 23:41:29 Done.
141 mtab_.insert(std::make_pair(mount_point, mount_device_and_id)); 249 mtab_.insert(std::make_pair(mount_point,
250 std::make_pair(mount_device, device_id)));
142 } 251 }
143 continue; 252 continue;
144 } 253 }
145 254
146 // Existing mount point. Check to see if a new device is mounted there. 255 // Existing mount point. Check to see if a new device is mounted there.
147 const MountDeviceAndId& old_mount_device_and_id = olditer->second; 256 if (mount_device == olditer->second.first)
148 if (mount_device == old_mount_device_and_id.first)
149 continue; 257 continue;
150 258
151 // New device mounted. 259 // New device mounted.
152 RemoveOldDevice(old_mount_device_and_id.second);
153 if (IsMediaDevice(mount_point)) { 260 if (IsMediaDevice(mount_point)) {
154 AddNewDevice(mount_device, mount_point, &id); 261 AddNewDevice(mount_device, mount_point, &device_id);
155 olditer->second = mount_device_and_id; 262 olditer->second = std::make_pair(mount_device, device_id);
156 } 263 }
157 } 264 }
158 } 265 }
159 266
160 void MediaDeviceNotificationsLinux::ReadMtab(MountMap* mtab) { 267 void MediaDeviceNotificationsLinux::ReadMtab(MountPointDeviceMap* mtab) {
161 FILE* fp = setmntent(mtab_path_.value().c_str(), "r"); 268 FILE* fp = setmntent(mtab_path_.value().c_str(), "r");
162 if (!fp) 269 if (!fp)
163 return; 270 return;
164 271
165 MountMap& new_mtab = *mtab; 272 // Helper map to store the device mount point details.
273 // (mount device, (mount point, entry position in mtab file))
274 typedef std::map<std::string,
275 std::pair<std::string, int> > DeviceMap;
vandebo (ex-Chrome) 2012/08/09 17:52:35 don't use a pair, use a struct
kmadhusu 2012/08/09 23:41:29 Done.
276 DeviceMap device_map;
vandebo (ex-Chrome) 2012/08/09 17:52:35 Move declaration of device_map to just before whil
kmadhusu 2012/08/09 23:41:29 Done.
277
278 MountPointDeviceMap& new_mtab = *mtab;
vandebo (ex-Chrome) 2012/08/09 17:52:35 Move new_mtab declaration to just before the for l
kmadhusu 2012/08/09 23:41:29 Done.
166 mntent entry; 279 mntent entry;
167 char buf[512]; 280 char buf[512];
168 int mount_position = 0; 281
169 typedef std::pair<std::string, std::string> MountPointAndId; 282 // Keep track of mount point entry positions in mtab file.
170 typedef std::map<std::string, MountPointAndId> DeviceMap; 283 int entry_pos = 0;
171 DeviceMap device_map; 284
172 while (getmntent_r(fp, &entry, buf, sizeof(buf))) { 285 while (getmntent_r(fp, &entry, buf, sizeof(buf))) {
173 // We only care about real file systems. 286 // We only care about real file systems.
174 if (!ContainsKey(known_file_systems_, entry.mnt_type)) 287 if (!ContainsKey(known_file_systems_, entry.mnt_type))
175 continue; 288 continue;
176 // Add entries, but overwrite entries for the same mount device. Keep track 289 const std::string& mount_device = entry.mnt_fsname;
vandebo (ex-Chrome) 2012/08/09 17:52:35 We probably want to keep the comment about overwri
kmadhusu 2012/08/09 23:41:29 Done.
177 // of the entry positions in the device id field and use that below to 290 const std::string& mount_point = entry.mnt_dir;
178 // resolve multiple devices mounted at the same mount point. 291 DeviceMap::iterator it = device_map.find(mount_device);
179 MountPointAndId mount_point_and_id =
180 std::make_pair(entry.mnt_dir, base::IntToString(mount_position++));
181 DeviceMap::iterator it = device_map.find(entry.mnt_fsname);
182 if (it == device_map.end()) { 292 if (it == device_map.end()) {
183 device_map.insert(std::make_pair(entry.mnt_fsname, mount_point_and_id)); 293 device_map.insert(std::make_pair(mount_device,
294 std::make_pair(mount_point,
295 entry_pos++)));
184 } else { 296 } else {
185 it->second = mount_point_and_id; 297 it->second = std::make_pair(mount_point, entry_pos++);
186 } 298 }
187 } 299 }
188 endmntent(fp); 300 endmntent(fp);
189 301
302 // Helper map to store mount point entries.
303 // (mount point, entry position in mtab file)
304 typedef std::map<std::string, int> MountPointsInfoMap;
vandebo (ex-Chrome) 2012/08/09 17:52:35 To make things simpler, I'd suggest pulling this l
kmadhusu 2012/08/09 23:41:29 Done.
vandebo (ex-Chrome) 2012/08/10 00:32:58 I guess it wasn't simpler.
kmadhusu 2012/08/10 19:41:01 As we discussed, reverted to my previous version o
305 MountPointsInfoMap mount_points_info_map;
306
190 for (DeviceMap::const_iterator device_it = device_map.begin(); 307 for (DeviceMap::const_iterator device_it = device_map.begin();
191 device_it != device_map.end(); 308 device_it != device_map.end();
192 ++device_it) { 309 ++device_it) {
193 const std::string& device = device_it->first; 310 const std::string& mount_device = device_it->first;
194 const std::string& mount_point = device_it->second.first; 311 const std::string& mount_point = device_it->second.first;
195 const std::string& position = device_it->second.second; 312 const int entry_pos = device_it->second.second;
196 313 MountPointDeviceMap::iterator new_mtab_it = new_mtab.find(mount_point);
197 // No device at |mount_point|, save |device| to it. 314 if (new_mtab_it == new_mtab.end()) {
198 MountMap::iterator mount_it = new_mtab.find(mount_point); 315 // No device at |mount_point|, save |device| to it.
199 if (mount_it == new_mtab.end()) { 316 new_mtab.insert(std::make_pair(mount_point, mount_device));
200 new_mtab.insert(std::make_pair(mount_point, 317 mount_points_info_map.insert(std::make_pair(mount_point, entry_pos));
201 std::make_pair(device, position))); 318 } else {
202 continue; 319 MountPointsInfoMap::iterator mount_position_it =
320 mount_points_info_map.find(mount_point);
321 DCHECK(mount_position_it != mount_points_info_map.end());
322 // There is already a device mounted at |mount_point|. Check to see if
323 // the existing mount entry is newer than the current one.
324 if (mount_position_it->second < entry_pos) {
325 // The current entry is newer, update the mount point entry.
326 mount_position_it->second = entry_pos;
327 new_mtab_it->second = mount_device;
328 }
203 } 329 }
204
205 // There is already a device mounted at |mount_point|. Check to see if
206 // the existing mount entry is newer than the current one.
207 std::string& existing_device = mount_it->second.first;
208 std::string& existing_position = mount_it->second.second;
209 if (existing_position > position)
210 continue;
211
212 // The current entry is newer, update the mount point entry.
213 existing_device = device;
214 existing_position = position;
215 } 330 }
216 } 331 }
217 332
218 void MediaDeviceNotificationsLinux::AddNewDevice( 333 void MediaDeviceNotificationsLinux::AddNewDevice(
219 const std::string& mount_device, 334 const std::string& mount_device,
220 const std::string& mount_point, 335 const std::string& mount_point,
221 std::string* device_id) { 336 std::string* device_id) {
222 *device_id = base::IntToString(current_device_id_++); 337 string16 device_name;
338 bool result = GetDeviceInfo(mount_device, device_id, &device_name);
339
340 // Keep track of GetDeviceInfo result, to see how often we fail to get device
341 // details.
342 UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_info_available",
vandebo (ex-Chrome) 2012/08/09 17:54:47 Can we distinguish these from the CrOS ones in the
kmadhusu 2012/08/09 23:41:29 We can use the same name. While viewing, we can fi
343 result);
344 if (!result)
345 return;
346
347 // Keep track of device uuid, to see how often we receive empty values.
348 UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_uuid_available",
349 !device_id->empty());
350 UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_name_available",
351 !device_name.empty());
352
353 if (device_id->empty() || device_name.empty())
354 return;
355
223 base::SystemMonitor* system_monitor = base::SystemMonitor::Get(); 356 base::SystemMonitor* system_monitor = base::SystemMonitor::Get();
224 system_monitor->ProcessMediaDeviceAttached(*device_id, 357 system_monitor->ProcessMediaDeviceAttached(*device_id,
225 UTF8ToUTF16(mount_device), 358 device_name,
226 SystemMonitor::TYPE_PATH, 359 SystemMonitor::TYPE_PATH,
227 mount_point); 360 mount_point);
228 } 361 }
229 362
230 void MediaDeviceNotificationsLinux::RemoveOldDevice( 363 void MediaDeviceNotificationsLinux::RemoveOldDevice(
231 const std::string& device_id) { 364 const std::string& device_id) {
232 base::SystemMonitor* system_monitor = base::SystemMonitor::Get(); 365 base::SystemMonitor* system_monitor = base::SystemMonitor::Get();
233 system_monitor->ProcessMediaDeviceDetached(device_id); 366 system_monitor->ProcessMediaDeviceDetached(device_id);
234 } 367 }
235 368
236 } // namespace chrome 369 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698