Chromium Code Reviews| 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 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_PICASA_ALBUMS_INDEXER_H_ | 5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_PICASA_ALBUMS_INDEXER_H_ |
| 6 #define CHROME_UTILITY_MEDIA_GALLERIES_PICASA_ALBUMS_INDEXER_H_ | 6 #define CHROME_UTILITY_MEDIA_GALLERIES_PICASA_ALBUMS_INDEXER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 | 13 |
| 14 namespace picasa { | 14 namespace picasa { |
| 15 | 15 |
| 16 // Defined outside of class because used by IPC messages. | |
| 17 typedef std::set<base::FilePath> AlbumImages; | |
| 18 typedef std::set<std::string> AlbumUUIDSet; | |
| 19 typedef std::map<std::string, AlbumImages> AlbumImagesMap; | |
| 20 | |
| 21 // Parses a series of INI files and builds up the set of files contained within | 16 // Parses a series of INI files and builds up the set of files contained within |
| 22 // the albums passed in through |album_uuids|. | 17 // the albums passed in through |album_uids|. |
| 23 // | 18 // |
| 24 // Each INI file only describes the images contained within a single directory. | 19 // Each INI file only describes the images contained within a single directory. |
| 25 // To build the contents of all the albums, we read in all the INI files | 20 // To build the contents of all the albums, we read in all the INI files |
| 26 // in all the Picasa folders. | 21 // in all the Picasa folders. |
| 27 // | 22 // |
| 28 // The INI albums also contain ".album*" sections describing the albums that | 23 // The INI albums also contain ".album*" sections describing the albums that |
| 29 // have pictures in the same directory as the INI. However, we use the PMP | 24 // have pictures in the same directory as the INI. However, we use the PMP |
| 30 // database as the authoritative source on Album metadata, so we ignore those | 25 // database as the authoritative source on Album metadata, so we ignore those |
| 31 // sections. The PMP derived |album_uuids| are passed in by the constructor. | 26 // sections. The PMP derived |album_uids| are passed in by the constructor. |
| 32 // | 27 // |
| 33 // Example INI File: | 28 // Example INI File: |
| 34 // | 29 // |
| 35 // [.album:e66fb059001aabcc69b262b7009fad90] | 30 // [.album:e66fb059001aabcc69b262b7009fad90] |
| 36 // name=CustomAlbum1 | 31 // name=CustomAlbum1 |
| 37 // token=e66fb059001aabcc69b262b7009fad90 | 32 // token=e66fb059001aabcc69b262b7009fad90 |
| 38 // date=2013-03-15T14:53:21-07:00 | 33 // date=2013-03-15T14:53:21-07:00 |
| 39 // [InBoth.jpg] | 34 // [InBoth.jpg] |
| 40 // albums=e66fb059001aabcc69b262b7009fad90,18cb2df48aaa98e1c276b45cfcd81c95 | 35 // albums=e66fb059001aabcc69b262b7009fad90,18cb2df48aaa98e1c276b45cfcd81c95 |
| 41 // [.album:18cb2df48aaa98e1c276b45cfcd81c95] | 36 // [.album:18cb2df48aaa98e1c276b45cfcd81c95] |
| 42 // name=CustomAlbum1 | 37 // name=CustomAlbum1 |
| 43 // token=18cb2df48aaa98e1c276b45cfcd81c95 | 38 // token=18cb2df48aaa98e1c276b45cfcd81c95 |
| 44 // date=2013-04-01T16:37:34-07:00 | 39 // date=2013-04-01T16:37:34-07:00 |
| 45 // [InFirst.jpg] | 40 // [InFirst.jpg] |
| 46 // albums=e66fb059001aabcc69b262b7009fad90 | 41 // albums=e66fb059001aabcc69b262b7009fad90 |
| 47 // [InSecond.jpg] | 42 // [InSecond.jpg] |
| 48 // albums=18cb2df48aaa98e1c276b45cfcd81c95 | 43 // albums=18cb2df48aaa98e1c276b45cfcd81c95 |
| 49 class PicasaAlbumsIndexer { | 44 class PicasaAlbumsIndexer { |
| 50 public: | 45 public: |
| 51 explicit PicasaAlbumsIndexer(const AlbumUUIDSet& album_uuids); | 46 explicit PicasaAlbumsIndexer(const AlbumUIDSet& album_uids); |
|
Lei Zhang
2013/07/02 22:08:17
I think you need to #include chrome/common/media_g
tommycli
2013/07/03 00:58:28
Done.
| |
| 52 ~PicasaAlbumsIndexer(); | 47 ~PicasaAlbumsIndexer(); |
| 53 | 48 |
| 54 // This method should be called once for each Folder in the PMP database. | 49 // This method should be called once for each Folder in the PMP database. |
| 55 void ParseFolderINI(const base::FilePath& folder_path, | 50 void ParseFolderINI(const base::FilePath& folder_path, |
| 56 const std::string& ini_contents); | 51 const std::string& ini_contents); |
| 57 | 52 |
| 58 const AlbumImagesMap& albums_images() const { return albums_images_; } | 53 const AlbumImagesMap& albums_images() const { return albums_images_; } |
| 59 | 54 |
| 60 private: | 55 private: |
| 61 AlbumImagesMap albums_images_; | 56 AlbumImagesMap albums_images_; |
| 62 | 57 |
| 63 DISALLOW_COPY_AND_ASSIGN(PicasaAlbumsIndexer); | 58 DISALLOW_COPY_AND_ASSIGN(PicasaAlbumsIndexer); |
| 64 }; | 59 }; |
| 65 | 60 |
| 66 } // namespace picasa | 61 } // namespace picasa |
| 67 | 62 |
| 68 #endif // CHROME_UTILITY_MEDIA_GALLERIES_PICASA_ALBUMS_INDEXER_H_ | 63 #endif // CHROME_UTILITY_MEDIA_GALLERIES_PICASA_ALBUMS_INDEXER_H_ |
| OLD | NEW |