| 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/iphoto_file_util.h" | 5 #include "chrome/browser/media_galleries/fileapi/iphoto_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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 file_list->push_back(DirectoryEntry(kIPhotoOriginalsDir, | 242 file_list->push_back(DirectoryEntry(kIPhotoOriginalsDir, |
| 243 DirectoryEntry::DIRECTORY, | 243 DirectoryEntry::DIRECTORY, |
| 244 0, base::Time())); | 244 0, base::Time())); |
| 245 } | 245 } |
| 246 std::map<std::string, base::FilePath> locations = | 246 std::map<std::string, base::FilePath> locations = |
| 247 GetDataProvider()->GetAlbumContents(components[1]); | 247 GetDataProvider()->GetAlbumContents(components[1]); |
| 248 for (std::map<std::string, base::FilePath>::const_iterator it = | 248 for (std::map<std::string, base::FilePath>::const_iterator it = |
| 249 locations.begin(); | 249 locations.begin(); |
| 250 it != locations.end(); it++) { | 250 it != locations.end(); it++) { |
| 251 base::PlatformFileInfo info; | 251 base::PlatformFileInfo info; |
| 252 if (!file_util::GetFileInfo(it->second, &info)) | 252 if (!base::GetFileInfo(it->second, &info)) |
| 253 return base::PLATFORM_FILE_ERROR_IO; | 253 return base::PLATFORM_FILE_ERROR_IO; |
| 254 file_list->push_back(DirectoryEntry(it->first, DirectoryEntry::FILE, | 254 file_list->push_back(DirectoryEntry(it->first, DirectoryEntry::FILE, |
| 255 info.size, info.last_modified)); | 255 info.size, info.last_modified)); |
| 256 } | 256 } |
| 257 return base::PLATFORM_FILE_OK; | 257 return base::PLATFORM_FILE_OK; |
| 258 } else if (components.size() == 3 && | 258 } else if (components.size() == 3 && |
| 259 components[2] == kIPhotoOriginalsDir && | 259 components[2] == kIPhotoOriginalsDir && |
| 260 GetDataProvider()->HasOriginals(components[1])) { | 260 GetDataProvider()->HasOriginals(components[1])) { |
| 261 std::map<std::string, base::FilePath> originals = | 261 std::map<std::string, base::FilePath> originals = |
| 262 GetDataProvider()->GetOriginals(components[1]); | 262 GetDataProvider()->GetOriginals(components[1]); |
| 263 for (std::map<std::string, base::FilePath>::const_iterator it = | 263 for (std::map<std::string, base::FilePath>::const_iterator it = |
| 264 originals.begin(); | 264 originals.begin(); |
| 265 it != originals.end(); it++) { | 265 it != originals.end(); it++) { |
| 266 base::PlatformFileInfo info; | 266 base::PlatformFileInfo info; |
| 267 if (!file_util::GetFileInfo(it->second, &info)) | 267 if (!base::GetFileInfo(it->second, &info)) |
| 268 return base::PLATFORM_FILE_ERROR_IO; | 268 return base::PLATFORM_FILE_ERROR_IO; |
| 269 file_list->push_back(DirectoryEntry(it->first, DirectoryEntry::FILE, | 269 file_list->push_back(DirectoryEntry(it->first, DirectoryEntry::FILE, |
| 270 info.size, info.last_modified)); | 270 info.size, info.last_modified)); |
| 271 } | 271 } |
| 272 return base::PLATFORM_FILE_OK; | 272 return base::PLATFORM_FILE_OK; |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| 276 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 276 return base::PLATFORM_FILE_ERROR_NOT_FOUND; |
| 277 } | 277 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 319 return base::PLATFORM_FILE_ERROR_NOT_FOUND; |
| 320 } | 320 } |
| 321 | 321 |
| 322 IPhotoDataProvider* IPhotoFileUtil::GetDataProvider() { | 322 IPhotoDataProvider* IPhotoFileUtil::GetDataProvider() { |
| 323 if (!imported_registry_) | 323 if (!imported_registry_) |
| 324 imported_registry_ = ImportedMediaGalleryRegistry::GetInstance(); | 324 imported_registry_ = ImportedMediaGalleryRegistry::GetInstance(); |
| 325 return imported_registry_->IPhotoDataProvider(); | 325 return imported_registry_->IPhotoDataProvider(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 } // namespace iphoto | 328 } // namespace iphoto |
| OLD | NEW |