OLD | NEW |
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 <libudev.h> |
10 #include <mntent.h> | 10 #include <mntent.h> |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 350 } |
351 | 351 |
352 void MediaDeviceNotificationsLinux::CheckAndAddMediaDevice( | 352 void MediaDeviceNotificationsLinux::CheckAndAddMediaDevice( |
353 const std::string& mount_device, | 353 const std::string& mount_device, |
354 const std::string& mount_point) { | 354 const std::string& mount_point) { |
355 if (!IsMediaDevice(mount_point)) | 355 if (!IsMediaDevice(mount_point)) |
356 return; | 356 return; |
357 | 357 |
358 std::string id; | 358 std::string id; |
359 string16 name; | 359 string16 name; |
360 bool result = (*get_device_info_func_)(mount_device, &id, &name); | 360 bool result = get_device_info_func_(mount_device, &id, &name); |
361 | 361 |
362 // Keep track of GetDeviceInfo result, to see how often we fail to get device | 362 // Keep track of GetDeviceInfo result, to see how often we fail to get device |
363 // details. | 363 // details. |
364 UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_info_available", | 364 UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_info_available", |
365 result); | 365 result); |
366 if (!result) | 366 if (!result) |
367 return; | 367 return; |
368 | 368 |
369 // Keep track of device uuid, to see how often we receive empty values. | 369 // Keep track of device uuid, to see how often we receive empty values. |
370 UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_uuid_available", | 370 UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_uuid_available", |
371 !id.empty()); | 371 !id.empty()); |
372 UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_name_available", | 372 UMA_HISTOGRAM_BOOLEAN("MediaDeviceNotification.device_name_available", |
373 !name.empty()); | 373 !name.empty()); |
374 | 374 |
375 if (id.empty() || name.empty()) | 375 if (id.empty() || name.empty()) |
376 return; | 376 return; |
377 | 377 |
378 MountDeviceAndId mount_device_and_id; | 378 MountDeviceAndId mount_device_and_id; |
379 mount_device_and_id.mount_device = mount_device; | 379 mount_device_and_id.mount_device = mount_device; |
380 mount_device_and_id.device_id = id; | 380 mount_device_and_id.device_id = id; |
381 mount_info_map_[mount_point] = mount_device_and_id; | 381 mount_info_map_[mount_point] = mount_device_and_id; |
382 | 382 |
383 SystemMonitor::Get()->ProcessMediaDeviceAttached(id, name, mount_point); | 383 SystemMonitor::Get()->ProcessRemovableStorageAttached(id, name, mount_point); |
384 } | 384 } |
385 | 385 |
386 void MediaDeviceNotificationsLinux::RemoveOldDevice( | 386 void MediaDeviceNotificationsLinux::RemoveOldDevice( |
387 const std::string& device_id) { | 387 const std::string& device_id) { |
388 SystemMonitor::Get()->ProcessMediaDeviceDetached(device_id); | 388 SystemMonitor::Get()->ProcessRemovableStorageDetached(device_id); |
389 } | 389 } |
390 | 390 |
391 } // namespace chrome | 391 } // namespace chrome |
OLD | NEW |