| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/media_galleries/fileapi/itunes_file_util.h" | 5 #include "chrome/browser/media_galleries/fileapi/itunes_file_util.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 base::PlatformFileError ITunesFileUtil::ReadDirectorySync( | 152 base::PlatformFileError ITunesFileUtil::ReadDirectorySync( |
| 153 fileapi::FileSystemOperationContext* context, | 153 fileapi::FileSystemOperationContext* context, |
| 154 const fileapi::FileSystemURL& url, | 154 const fileapi::FileSystemURL& url, |
| 155 EntryList* file_list) { | 155 EntryList* file_list) { |
| 156 DCHECK(file_list->empty()); | 156 DCHECK(file_list->empty()); |
| 157 std::vector<std::string> components; | 157 std::vector<std::string> components; |
| 158 fileapi::VirtualPath::GetComponentsUTF8Unsafe(url.path(), &components); | 158 fileapi::VirtualPath::GetComponentsUTF8Unsafe(url.path(), &components); |
| 159 | 159 |
| 160 if (components.size() == 0) { | 160 if (components.size() == 0) { |
| 161 base::PlatformFileInfo xml_info; | 161 base::File::Info xml_info; |
| 162 if (!base::GetFileInfo(GetDataProvider()->library_path(), &xml_info)) | 162 if (!base::GetFileInfo(GetDataProvider()->library_path(), &xml_info)) |
| 163 return base::PLATFORM_FILE_ERROR_IO; | 163 return base::PLATFORM_FILE_ERROR_IO; |
| 164 file_list->push_back(DirectoryEntry(kITunesLibraryXML, | 164 file_list->push_back(DirectoryEntry(kITunesLibraryXML, |
| 165 DirectoryEntry::FILE, | 165 DirectoryEntry::FILE, |
| 166 xml_info.size, xml_info.last_modified)); | 166 xml_info.size, xml_info.last_modified)); |
| 167 file_list->push_back(DirectoryEntry(kITunesMediaDir, | 167 file_list->push_back(DirectoryEntry(kITunesMediaDir, |
| 168 DirectoryEntry::DIRECTORY, | 168 DirectoryEntry::DIRECTORY, |
| 169 0, base::Time())); | 169 0, base::Time())); |
| 170 return base::PLATFORM_FILE_OK; | 170 return base::PLATFORM_FILE_OK; |
| 171 } | 171 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 return base::PLATFORM_FILE_OK; | 218 return base::PLATFORM_FILE_OK; |
| 219 } | 219 } |
| 220 | 220 |
| 221 if (components.size() == 4) { | 221 if (components.size() == 4) { |
| 222 ITunesDataProvider::Album album = | 222 ITunesDataProvider::Album album = |
| 223 GetDataProvider()->GetAlbum(components[2], components[3]); | 223 GetDataProvider()->GetAlbum(components[2], components[3]); |
| 224 if (album.size() == 0) | 224 if (album.size() == 0) |
| 225 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 225 return base::PLATFORM_FILE_ERROR_NOT_FOUND; |
| 226 ITunesDataProvider::Album::const_iterator it; | 226 ITunesDataProvider::Album::const_iterator it; |
| 227 for (it = album.begin(); it != album.end(); ++it) { | 227 for (it = album.begin(); it != album.end(); ++it) { |
| 228 base::PlatformFileInfo file_info; | 228 base::File::Info file_info; |
| 229 if (media_path_filter()->Match(it->second) && | 229 if (media_path_filter()->Match(it->second) && |
| 230 base::GetFileInfo(it->second, &file_info)) { | 230 base::GetFileInfo(it->second, &file_info)) { |
| 231 file_list->push_back(DirectoryEntry(it->first, DirectoryEntry::FILE, | 231 file_list->push_back(DirectoryEntry(it->first, DirectoryEntry::FILE, |
| 232 file_info.size, | 232 file_info.size, |
| 233 file_info.last_modified)); | 233 file_info.last_modified)); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 return base::PLATFORM_FILE_OK; | 236 return base::PLATFORM_FILE_OK; |
| 237 } | 237 } |
| 238 | 238 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 callback); | 381 callback); |
| 382 } | 382 } |
| 383 | 383 |
| 384 ITunesDataProvider* ITunesFileUtil::GetDataProvider() { | 384 ITunesDataProvider* ITunesFileUtil::GetDataProvider() { |
| 385 if (!imported_registry_) | 385 if (!imported_registry_) |
| 386 imported_registry_ = ImportedMediaGalleryRegistry::GetInstance(); | 386 imported_registry_ = ImportedMediaGalleryRegistry::GetInstance(); |
| 387 return imported_registry_->ITunesDataProvider(); | 387 return imported_registry_->ITunesDataProvider(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace itunes | 390 } // namespace itunes |
| OLD | NEW |