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_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PICASA_ALBUM_TABLE_READER_
H_ | 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_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PICASA_ALBUM_TABLE_READER_
H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/platform_file.h" |
10 #include "base/time.h" | 11 #include "base/time.h" |
11 | 12 |
12 namespace picasa { | 13 namespace picasa { |
13 | 14 |
14 const base::Time::Exploded kPicasaVariantTimeEpoch = { | 15 const base::Time::Exploded kPicasaVariantTimeEpoch = { |
15 1899, 12, 7, 30, // Dec 30, 1899 (Saturday) | 16 1899, 12, 7, 30, // Dec 30, 1899 (Saturday) |
16 0, 0, 0, 0 // 00:00:00.000 | 17 0, 0, 0, 0 // 00:00:00.000 |
17 }; | 18 }; |
18 | 19 |
19 const char kPicasaAlbumTableName[] = "albumdata"; | 20 const char kPicasaAlbumTableName[] = "albumdata"; |
(...skipping 10 matching lines...) Expand all Loading... |
30 const std::string& uid, const base::FilePath& path); | 31 const std::string& uid, const base::FilePath& path); |
31 | 32 |
32 ~AlbumInfo(); | 33 ~AlbumInfo(); |
33 | 34 |
34 std::string name; | 35 std::string name; |
35 base::Time timestamp; | 36 base::Time timestamp; |
36 std::string uid; | 37 std::string uid; |
37 base::FilePath path; | 38 base::FilePath path; |
38 }; | 39 }; |
39 | 40 |
| 41 struct PicasaAlbumTableFiles { |
| 42 explicit PicasaAlbumTableFiles(const base::FilePath& directory_path); |
| 43 |
| 44 // Special empty file used to confirm existence of table. |
| 45 base::PlatformFile indicator_file; |
| 46 |
| 47 base::PlatformFile category_file; |
| 48 base::PlatformFile date_file; |
| 49 base::PlatformFile filename_file; |
| 50 base::PlatformFile name_file; |
| 51 base::PlatformFile token_file; |
| 52 base::PlatformFile uid_file; |
| 53 }; |
| 54 |
40 class PicasaAlbumTableReader { | 55 class PicasaAlbumTableReader { |
41 public: | 56 public: |
42 // |directory_path| is Picasa's db3 directory where the PMP table is stored. | 57 explicit PicasaAlbumTableReader(const PicasaAlbumTableFiles& table_files); |
43 explicit PicasaAlbumTableReader(const base::FilePath& directory_path); | |
44 virtual ~PicasaAlbumTableReader(); | 58 virtual ~PicasaAlbumTableReader(); |
45 | 59 |
46 bool Init(); | 60 bool Init(); |
47 | 61 |
48 const std::vector<AlbumInfo>& albums() const; | 62 const std::vector<AlbumInfo>& albums() const; |
49 const std::vector<AlbumInfo>& folders() const; | 63 const std::vector<AlbumInfo>& folders() const; |
50 | 64 |
51 private: | 65 private: |
52 const base::FilePath directory_path_; | 66 const PicasaAlbumTableFiles table_files_; |
53 | 67 |
54 bool initialized_; | 68 bool initialized_; |
55 | 69 |
56 std::vector<AlbumInfo> albums_; | 70 std::vector<AlbumInfo> albums_; |
57 std::vector<AlbumInfo> folders_; | 71 std::vector<AlbumInfo> folders_; |
58 | 72 |
59 DISALLOW_COPY_AND_ASSIGN(PicasaAlbumTableReader); | 73 DISALLOW_COPY_AND_ASSIGN(PicasaAlbumTableReader); |
60 }; | 74 }; |
61 | 75 |
| 76 void ClosePicasaAlbumTableFiles(PicasaAlbumTableFiles* table_files); |
| 77 |
62 } // namespace picasa | 78 } // namespace picasa |
63 | 79 |
64 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PICASA_ALBUM_TABLE_READ
ER_H_ | 80 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PICASA_ALBUM_TABLE_READ
ER_H_ |
OLD | NEW |