| 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 #include "chrome/browser/storage_monitor/media_storage_util.h" | 5 #include "chrome/browser/storage_monitor/media_storage_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/browser/storage_monitor/removable_device_constants.h" | 15 #include "chrome/browser/storage_monitor/removable_device_constants.h" |
| 16 #include "chrome/browser/storage_monitor/storage_monitor.h" | 16 #include "chrome/browser/storage_monitor/storage_monitor.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 | 18 |
| 19 using content::BrowserThread; | 19 using content::BrowserThread; |
| 20 | 20 |
| 21 namespace chrome { | |
| 22 | |
| 23 namespace { | 21 namespace { |
| 24 | 22 |
| 25 // MediaDeviceNotification.DeviceInfo histogram values. | 23 // MediaDeviceNotification.DeviceInfo histogram values. |
| 26 enum DeviceInfoHistogramBuckets { | 24 enum DeviceInfoHistogramBuckets { |
| 27 MASS_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE, | 25 MASS_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE, |
| 28 MASS_STORAGE_DEVICE_UUID_MISSING, | 26 MASS_STORAGE_DEVICE_UUID_MISSING, |
| 29 MASS_STORAGE_DEVICE_NAME_MISSING, | 27 MASS_STORAGE_DEVICE_NAME_MISSING, |
| 30 MASS_STORAGE_DEVICE_NAME_AND_UUID_MISSING, | 28 MASS_STORAGE_DEVICE_NAME_AND_UUID_MISSING, |
| 31 MTP_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE, | 29 MTP_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE, |
| 32 MTP_STORAGE_DEVICE_UUID_MISSING, | 30 MTP_STORAGE_DEVICE_UUID_MISSING, |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 bool MediaStorageUtil::IsRemovableStorageAttached(const std::string& id) { | 242 bool MediaStorageUtil::IsRemovableStorageAttached(const std::string& id) { |
| 245 StorageInfoList devices = | 243 StorageInfoList devices = |
| 246 StorageMonitor::GetInstance()->GetAllAvailableStorages(); | 244 StorageMonitor::GetInstance()->GetAllAvailableStorages(); |
| 247 for (StorageInfoList::const_iterator it = devices.begin(); | 245 for (StorageInfoList::const_iterator it = devices.begin(); |
| 248 it != devices.end(); ++it) { | 246 it != devices.end(); ++it) { |
| 249 if (StorageInfo::IsRemovableDevice(id) && it->device_id() == id) | 247 if (StorageInfo::IsRemovableDevice(id) && it->device_id() == id) |
| 250 return true; | 248 return true; |
| 251 } | 249 } |
| 252 return false; | 250 return false; |
| 253 } | 251 } |
| 254 | |
| 255 } // namespace chrome | |
| OLD | NEW |