| 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 |
| 11 #include "base/ini_parser.h" | |
| 12 #include "base/logging.h" | 11 #include "base/logging.h" |
| 13 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 14 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "chrome/common/ini_parser.h" |
| 15 | 15 |
| 16 namespace picasa { | 16 namespace picasa { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 const char kAlbumSectionHeader[] = ".album:"; | 20 const char kAlbumSectionHeader[] = ".album:"; |
| 21 const char kAlbumsKey[] = "albums"; | 21 const char kAlbumsKey[] = "albums"; |
| 22 const int kMaxDedupeNumber = 1000; // Chosen arbitrarily. | 22 const int kMaxDedupeNumber = 1000; // Chosen arbitrarily. |
| 23 | 23 |
| 24 class PicasaINIParser : public base::INIParser { | 24 class PicasaINIParser : public INIParser { |
| 25 public: | 25 public: |
| 26 PicasaINIParser( | 26 PicasaINIParser( |
| 27 const base::FilePath& folder_path, AlbumImagesMap* albums_images) | 27 const base::FilePath& folder_path, AlbumImagesMap* albums_images) |
| 28 : folder_path_(folder_path), | 28 : folder_path_(folder_path), |
| 29 albums_images_(albums_images) { | 29 albums_images_(albums_images) { |
| 30 } | 30 } |
| 31 virtual ~PicasaINIParser() {} | 31 virtual ~PicasaINIParser() {} |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 virtual void HandleTriplet(const std::string& section, | 34 virtual void HandleTriplet(const std::string& section, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 for (std::vector<picasa::FolderINIContents>::const_iterator it = | 104 for (std::vector<picasa::FolderINIContents>::const_iterator it = |
| 105 folders_inis_sorted.begin(); | 105 folders_inis_sorted.begin(); |
| 106 it != folders_inis_sorted.end(); | 106 it != folders_inis_sorted.end(); |
| 107 ++it) { | 107 ++it) { |
| 108 PicasaINIParser parser(it->folder_path, &albums_images_); | 108 PicasaINIParser parser(it->folder_path, &albums_images_); |
| 109 parser.Parse(it->ini_contents); | 109 parser.Parse(it->ini_contents); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace picasa | 113 } // namespace picasa |
| OLD | NEW |