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" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 } // namespace | 99 } // namespace |
100 | 100 |
101 // static | 101 // static |
102 bool MediaStorageUtil::HasDcim(const base::FilePath& mount_point) { | 102 bool MediaStorageUtil::HasDcim(const base::FilePath& mount_point) { |
103 DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 103 DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
104 | 104 |
105 base::FilePath::StringType dcim_dir(kDCIMDirectoryName); | 105 base::FilePath::StringType dcim_dir(kDCIMDirectoryName); |
106 if (!file_util::DirectoryExists(mount_point.Append(dcim_dir))) { | 106 if (!base::DirectoryExists(mount_point.Append(dcim_dir))) { |
107 // Check for lowercase 'dcim' as well. | 107 // Check for lowercase 'dcim' as well. |
108 base::FilePath dcim_path_lower( | 108 base::FilePath dcim_path_lower( |
109 mount_point.Append(StringToLowerASCII(dcim_dir))); | 109 mount_point.Append(StringToLowerASCII(dcim_dir))); |
110 if (!file_util::DirectoryExists(dcim_path_lower)) | 110 if (!base::DirectoryExists(dcim_path_lower)) |
111 return false; | 111 return false; |
112 } | 112 } |
113 return true; | 113 return true; |
114 } | 114 } |
115 | 115 |
116 // static | 116 // static |
117 bool MediaStorageUtil::CanCreateFileSystem(const std::string& device_id, | 117 bool MediaStorageUtil::CanCreateFileSystem(const std::string& device_id, |
118 const base::FilePath& path) { | 118 const base::FilePath& path) { |
119 StorageInfo::Type type; | 119 StorageInfo::Type type; |
120 if (!StorageInfo::CrackDeviceId(device_id, &type, NULL)) | 120 if (!StorageInfo::CrackDeviceId(device_id, &type, NULL)) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 StorageMonitor::GetInstance()->GetAllAvailableStorages(); | 246 StorageMonitor::GetInstance()->GetAllAvailableStorages(); |
247 for (StorageInfoList::const_iterator it = devices.begin(); | 247 for (StorageInfoList::const_iterator it = devices.begin(); |
248 it != devices.end(); ++it) { | 248 it != devices.end(); ++it) { |
249 if (StorageInfo::IsRemovableDevice(id) && it->device_id() == id) | 249 if (StorageInfo::IsRemovableDevice(id) && it->device_id() == id) |
250 return true; | 250 return true; |
251 } | 251 } |
252 return false; | 252 return false; |
253 } | 253 } |
254 | 254 |
255 } // namespace chrome | 255 } // namespace chrome |
OLD | NEW |