| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PICASA_ALBUM_TABLE_READER_
H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PICASA_ALBUM_TABLE_READER_
H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/files/file_path.h" |
| 10 #include "base/time.h" |
| 11 |
| 12 namespace picasaimport { |
| 13 |
| 14 const base::Time::Exploded kPicasaVariantTimeEpoch = { |
| 15 1899, 12, 7, 30, // Dec 30, 1899 (Saturday) |
| 16 0, 0, 0, 0 // 00:00:00.000 |
| 17 }; |
| 18 |
| 19 const char kPicasaAlbumTableName[] = "albumdata"; |
| 20 |
| 21 const uint32 kAlbumCategoryUserAlbum = 0; |
| 22 const uint32 kAlbumCategoryFolder = 2; |
| 23 const uint32 kAlbumCategoryInvalid = 0xffff; // Sentinel value. |
| 24 |
| 25 const char kAlbumTokenPrefix[] = "]album:"; |
| 26 |
| 27 struct AlbumInfo { |
| 28 AlbumInfo(const std::string& name, const base::Time& timestamp, |
| 29 const std::string& uid); |
| 30 |
| 31 ~AlbumInfo(); |
| 32 |
| 33 std::string name; |
| 34 base::Time timestamp; |
| 35 std::string uid; |
| 36 }; |
| 37 |
| 38 struct FolderInfo { |
| 39 FolderInfo(const std::string& name, const base::Time& timestamp, |
| 40 const std::string& uid, const base::FilePath& path); |
| 41 |
| 42 ~FolderInfo(); |
| 43 |
| 44 std::string name; |
| 45 base::Time timestamp; |
| 46 std::string uid; |
| 47 base::FilePath path; |
| 48 }; |
| 49 |
| 50 class PicasaAlbumTableReader { |
| 51 public: |
| 52 // |directory_path| is Picasa's db3 directory where the PMP table is stored. |
| 53 explicit PicasaAlbumTableReader(const base::FilePath& directory_path); |
| 54 virtual ~PicasaAlbumTableReader(); |
| 55 |
| 56 bool Init(); |
| 57 |
| 58 const std::vector<FolderInfo>& folders() const; |
| 59 |
| 60 const std::vector<AlbumInfo>& user_albums() const; |
| 61 |
| 62 static base::FilePath PicasaDB3Dir(); |
| 63 |
| 64 protected: |
| 65 PicasaAlbumTableReader(const std::vector<FolderInfo>& folders, |
| 66 const std::vector<AlbumInfo>& user_albums); |
| 67 |
| 68 private: |
| 69 const base::FilePath directory_path_; |
| 70 |
| 71 bool initialized_; |
| 72 |
| 73 std::vector<FolderInfo> folders_; |
| 74 std::vector<AlbumInfo> user_albums_; |
| 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(PicasaAlbumTableReader); |
| 77 }; |
| 78 |
| 79 } // namespace picasaimport |
| 80 |
| 81 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PICASA_ALBUM_TABLE_READ
ER_H_ |
| OLD | NEW |