Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: chrome/utility/media_galleries/picasa_albums_indexer.cc

Issue 18562007: Media Galleries API Picasa: Put INI indexing step into sandboxed utility process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0035-picasa-import-sandbox-pmp-reading
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/media_galleries/picasa_types.h"
5 #include "chrome/utility/media_galleries/picasa_albums_indexer.h" 6 #include "chrome/utility/media_galleries/picasa_albums_indexer.h"
6 7
7 #include <vector> 8 #include <vector>
8 9
9 #include "base/ini_parser.h" 10 #include "base/ini_parser.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
12 13
13 namespace picasa { 14 namespace picasa {
14 15
(...skipping 21 matching lines...) Expand all
36 // [.album:*] sections ignored as we get that data from the PMP files. 37 // [.album:*] sections ignored as we get that data from the PMP files.
37 if (section.find(kAlbumSectionHeader) == 0) 38 if (section.find(kAlbumSectionHeader) == 0)
38 return; 39 return;
39 40
40 std::vector<std::string> containing_albums; 41 std::vector<std::string> containing_albums;
41 base::SplitString(value, ',', &containing_albums); 42 base::SplitString(value, ',', &containing_albums);
42 for (std::vector<std::string>::iterator it = containing_albums.begin(); 43 for (std::vector<std::string>::iterator it = containing_albums.begin();
43 it != containing_albums.end(); ++it) { 44 it != containing_albums.end(); ++it) {
44 AlbumImagesMap::iterator album_map_it = albums_images_->find(*it); 45 AlbumImagesMap::iterator album_map_it = albums_images_->find(*it);
45 46
46 // Ignore entry if the album UUID is not listed among in |album_uuids| 47 // Ignore entry if the album uid is not listed among in |album_uids|
47 // in the constructor. Happens if the PMP and INI files are inconsistent. 48 // in the constructor. Happens if the PMP and INI files are inconsistent.
48 if (album_map_it == albums_images_->end()) 49 if (album_map_it == albums_images_->end())
49 continue; 50 continue;
50 51
51 album_map_it->second.insert( 52 album_map_it->second.insert(
52 folder_path_.Append(base::FilePath::FromUTF8Unsafe(section))); 53 folder_path_.Append(base::FilePath::FromUTF8Unsafe(section)));
53 } 54 }
54 } 55 }
55 56
56 const base::FilePath folder_path_; 57 const base::FilePath folder_path_;
57 AlbumImagesMap* const albums_images_; 58 AlbumImagesMap* const albums_images_;
58 }; 59 };
59 60
60 } // namespace 61 } // namespace
61 62
62 PicasaAlbumsIndexer::PicasaAlbumsIndexer( 63 PicasaAlbumsIndexer::PicasaAlbumsIndexer(const AlbumUIDSet& album_uids) {
63 const AlbumUUIDSet& album_uuids) { 64 // Create an entry in the map for the valid album uids.
64 // Create an entry in the map for the valid album uuids. 65 for (AlbumUIDSet::const_iterator it = album_uids.begin();
65 for (AlbumUUIDSet::const_iterator it = album_uuids.begin(); 66 it != album_uids.end(); ++it) {
66 it != album_uuids.end(); ++it) {
67 albums_images_[*it] = AlbumImages(); 67 albums_images_[*it] = AlbumImages();
68 } 68 }
69 } 69 }
70 70
71 PicasaAlbumsIndexer::~PicasaAlbumsIndexer() {} 71 PicasaAlbumsIndexer::~PicasaAlbumsIndexer() {}
72 72
73 void PicasaAlbumsIndexer::ParseFolderINI( 73 void PicasaAlbumsIndexer::ParseFolderINI(
74 const base::FilePath& folder_path, const std::string& ini_contents) { 74 const base::FilePath& folder_path, const std::string& ini_contents) {
75 PicasaINIParser parser(folder_path, &albums_images_); 75 PicasaINIParser parser(folder_path, &albums_images_);
76 parser.Parse(ini_contents); 76 parser.Parse(ini_contents);
77 } 77 }
78 78
79 } // namespace picasa 79 } // namespace picasa
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698