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/utility/media_galleries/picasa_albums_indexer.h" | 5 #include "chrome/utility/media_galleries/picasa_albums_indexer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 void HandleTriplet(const std::string& section, | 34 void HandleTriplet(const std::string& section, |
35 const std::string& key, | 35 const std::string& key, |
36 const std::string& value) override { | 36 const std::string& value) override { |
37 if (key != kAlbumsKey) | 37 if (key != kAlbumsKey) |
38 return; | 38 return; |
39 | 39 |
40 // [.album:*] sections ignored as we get that data from the PMP files. | 40 // [.album:*] sections ignored as we get that data from the PMP files. |
41 if (section.find(kAlbumSectionHeader) == 0) | 41 if (section.find(kAlbumSectionHeader) == 0) |
42 return; | 42 return; |
43 | 43 |
44 std::vector<std::string> containing_albums; | 44 for (const std::string& album : base::SplitString( |
45 base::SplitString(value, ',', &containing_albums); | 45 value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
46 for (std::vector<std::string>::iterator it = containing_albums.begin(); | 46 AlbumImagesMap::iterator album_map_it = albums_images_->find(album); |
47 it != containing_albums.end(); ++it) { | |
48 AlbumImagesMap::iterator album_map_it = albums_images_->find(*it); | |
49 | 47 |
50 // Ignore entry if the album uid is not listed among in |album_uids| | 48 // Ignore entry if the album uid is not listed among in |album_uids| |
51 // in the constructor. Happens if the PMP and INI files are inconsistent. | 49 // in the constructor. Happens if the PMP and INI files are inconsistent. |
52 if (album_map_it == albums_images_->end()) | 50 if (album_map_it == albums_images_->end()) |
53 continue; | 51 continue; |
54 | 52 |
55 base::FilePath filename = base::FilePath::FromUTF8Unsafe(section); | 53 base::FilePath filename = base::FilePath::FromUTF8Unsafe(section); |
56 AlbumImages& album_images = album_map_it->second; | 54 AlbumImages& album_images = album_map_it->second; |
57 | 55 |
58 // If filename is first of its name in album, simply add. | 56 // If filename is first of its name in album, simply add. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 for (std::vector<picasa::FolderINIContents>::const_iterator it = | 102 for (std::vector<picasa::FolderINIContents>::const_iterator it = |
105 folders_inis_sorted.begin(); | 103 folders_inis_sorted.begin(); |
106 it != folders_inis_sorted.end(); | 104 it != folders_inis_sorted.end(); |
107 ++it) { | 105 ++it) { |
108 PicasaINIParser parser(it->folder_path, &albums_images_); | 106 PicasaINIParser parser(it->folder_path, &albums_images_); |
109 parser.Parse(it->ini_contents); | 107 parser.Parse(it->ini_contents); |
110 } | 108 } |
111 } | 109 } |
112 | 110 |
113 } // namespace picasa | 111 } // namespace picasa |
OLD | NEW |