| 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_data_provider.h" | 5 #include "chrome/browser/media_galleries/fileapi/iphoto_data_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
| 17 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 17 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 18 #include "chrome/browser/media_galleries/fileapi/safe_iapps_library_parser.h" | 18 #include "chrome/browser/media_galleries/fileapi/safe_iapps_library_parser.h" |
| 19 #include "content/public/browser/browser_thread.h" | |
| 20 | 19 |
| 21 namespace iphoto { | 20 namespace iphoto { |
| 22 | 21 |
| 23 IPhotoDataProvider::IPhotoDataProvider(const base::FilePath& library_path) | 22 IPhotoDataProvider::IPhotoDataProvider(const base::FilePath& library_path) |
| 24 : iapps::IAppsDataProvider(library_path), | 23 : iapps::IAppsDataProvider(library_path), |
| 25 weak_factory_(this) {} | 24 weak_factory_(this) {} |
| 26 | 25 |
| 27 IPhotoDataProvider::~IPhotoDataProvider() {} | 26 IPhotoDataProvider::~IPhotoDataProvider() {} |
| 28 | 27 |
| 29 void IPhotoDataProvider::DoParseLibrary( | 28 void IPhotoDataProvider::DoParseLibrary( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 IdIndex::const_iterator photo_it = photo_id_index.find(id); | 74 IdIndex::const_iterator photo_it = photo_id_index.find(id); |
| 76 if (photo_it == photo_id_index.end()) | 75 if (photo_it == photo_id_index.end()) |
| 77 continue; | 76 continue; |
| 78 | 77 |
| 79 std::string filename = photo_it->second->BaseName().value(); | 78 std::string filename = photo_it->second->BaseName().value(); |
| 80 if (ContainsKey(album_paths, filename)) | 79 if (ContainsKey(album_paths, filename)) |
| 81 dupe_ids.insert(id); | 80 dupe_ids.insert(id); |
| 82 else | 81 else |
| 83 album_paths.insert(filename); | 82 album_paths.insert(filename); |
| 84 } | 83 } |
| 85 } | 84 } |
| 86 | 85 |
| 87 // Now build the directory index. | 86 // Now build the directory index. |
| 88 dir_index_.clear(); | 87 dir_index_.clear(); |
| 89 originals_index_.clear(); | 88 originals_index_.clear(); |
| 90 for (parser::Albums::const_iterator album_it = library.albums.begin(); | 89 for (parser::Albums::const_iterator album_it = library.albums.begin(); |
| 91 album_it != library.albums.end(); album_it++) { | 90 album_it != library.albums.end(); album_it++) { |
| 92 std::string album_name = album_it->first; | 91 std::string album_name = album_it->first; |
| 93 const parser::Album& album = album_it->second; | 92 const parser::Album& album = album_it->second; |
| 94 | 93 |
| 95 for (parser::Album::const_iterator id_it = album.begin(); | 94 for (parser::Album::const_iterator id_it = album.begin(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 DirIndex::const_iterator originals_it = originals_index_.find(album); | 178 DirIndex::const_iterator originals_it = originals_index_.find(album); |
| 180 if (originals_it == originals_index_.end()) | 179 if (originals_it == originals_index_.end()) |
| 181 return base::FilePath(); | 180 return base::FilePath(); |
| 182 FileIndex::const_iterator file_it = originals_it->second.find(filename); | 181 FileIndex::const_iterator file_it = originals_it->second.find(filename); |
| 183 if (file_it == originals_it->second.end()) | 182 if (file_it == originals_it->second.end()) |
| 184 return base::FilePath(); | 183 return base::FilePath(); |
| 185 return file_it->second; | 184 return file_it->second; |
| 186 } | 185 } |
| 187 | 186 |
| 188 } // namespace iphoto | 187 } // namespace iphoto |
| OLD | NEW |