| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/storage_monitor/media_storage_util.h" | 5 #include "components/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/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } // namespace | 92 } // namespace |
| 93 | 93 |
| 94 // static | 94 // static |
| 95 bool MediaStorageUtil::HasDcim(const base::FilePath& mount_point) { | 95 bool MediaStorageUtil::HasDcim(const base::FilePath& mount_point) { |
| 96 DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 96 DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 97 | 97 |
| 98 base::FilePath::StringType dcim_dir(kDCIMDirectoryName); | 98 base::FilePath::StringType dcim_dir(kDCIMDirectoryName); |
| 99 if (!base::DirectoryExists(mount_point.Append(dcim_dir))) { | 99 if (!base::DirectoryExists(mount_point.Append(dcim_dir))) { |
| 100 // Check for lowercase 'dcim' as well. | 100 // Check for lowercase 'dcim' as well. |
| 101 base::FilePath dcim_path_lower( | 101 base::FilePath dcim_path_lower( |
| 102 mount_point.Append(base::StringToLowerASCII(dcim_dir))); | 102 mount_point.Append(base::ToLowerASCII(dcim_dir))); |
| 103 if (!base::DirectoryExists(dcim_path_lower)) | 103 if (!base::DirectoryExists(dcim_path_lower)) |
| 104 return false; | 104 return false; |
| 105 } | 105 } |
| 106 return true; | 106 return true; |
| 107 } | 107 } |
| 108 | 108 |
| 109 // static | 109 // static |
| 110 bool MediaStorageUtil::CanCreateFileSystem(const std::string& device_id, | 110 bool MediaStorageUtil::CanCreateFileSystem(const std::string& device_id, |
| 111 const base::FilePath& path) { | 111 const base::FilePath& path) { |
| 112 StorageInfo::Type type; | 112 StorageInfo::Type type; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 StorageMonitor::GetInstance()->GetAllAvailableStorages(); | 241 StorageMonitor::GetInstance()->GetAllAvailableStorages(); |
| 242 for (StorageInfoList::const_iterator it = devices.begin(); | 242 for (StorageInfoList::const_iterator it = devices.begin(); |
| 243 it != devices.end(); ++it) { | 243 it != devices.end(); ++it) { |
| 244 if (StorageInfo::IsRemovableDevice(id) && it->device_id() == id) | 244 if (StorageInfo::IsRemovableDevice(id) && it->device_id() == id) |
| 245 return true; | 245 return true; |
| 246 } | 246 } |
| 247 return false; | 247 return false; |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace storage_monitor | 250 } // namespace storage_monitor |
| OLD | NEW |