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.
5 #ifndef CHROME_COMMON_MEDIA_GALLERIES_PICASA_TYPES_H_
6 #define CHROME_COMMON_MEDIA_GALLERIES_PICASA_TYPES_H_
12 #include "base/files/file_path.h"
13 #include "base/platform_file.h"
14 #include "ipc/ipc_platform_file.h"
20 // Map of de-duplicated filenames to the platform paths for a given album.
22 // Bar.jpg -> /path/to/Bar.jpg
23 // Foo.jpg -> /path/to/Foo.jpg
24 // Foo (1).jpg -> /path/to/another/Foo.jpg
25 // TODO(tommycli): Rename this type to a more intuitive name.
26 typedef std::map<std::string, base::FilePath> AlbumImages;
27 typedef std::set<std::string> AlbumUIDSet;
28 // Map of album uids to a collection of its images.
29 typedef std::map<std::string, AlbumImages> AlbumImagesMap;
30 typedef std::map<std::string, AlbumInfo> AlbumMap;
32 extern const char kPicasaDatabaseDirName[];
33 extern const char kPicasaTempDirName[];
34 extern const char kPicasaINIFilename[];
36 extern const char kPicasaAlbumTableName[];
37 extern const char kAlbumTokenPrefix[];
39 extern const uint32 kAlbumCategoryAlbum;
40 extern const uint32 kAlbumCategoryFolder;
41 extern const uint32 kAlbumCategoryInvalid;
45 AlbumInfo(const std::string& name, const base::Time& timestamp,
46 const std::string& uid, const base::FilePath& path);
56 struct AlbumTableFiles {
58 explicit AlbumTableFiles(const base::FilePath& directory_path);
60 // Special empty file used to confirm existence of table.
61 base::PlatformFile indicator_file;
63 base::PlatformFile category_file;
64 base::PlatformFile date_file;
65 base::PlatformFile filename_file;
66 base::PlatformFile name_file;
67 base::PlatformFile token_file;
68 base::PlatformFile uid_file;
71 // A mirror of AlbumTableFiles but for transit.
72 struct AlbumTableFilesForTransit {
73 AlbumTableFilesForTransit();
74 IPC::PlatformFileForTransit indicator_file;
76 IPC::PlatformFileForTransit category_file;
77 IPC::PlatformFileForTransit date_file;
78 IPC::PlatformFileForTransit filename_file;
79 IPC::PlatformFileForTransit name_file;
80 IPC::PlatformFileForTransit token_file;
81 IPC::PlatformFileForTransit uid_file;
84 struct FolderINIContents {
85 base::FilePath folder_path;
86 std::string ini_contents;
88 bool operator<(const FolderINIContents& that) const {
89 return folder_path < that.folder_path;
93 void CloseAlbumTableFiles(AlbumTableFiles* table_files);
97 #endif // CHROME_COMMON_MEDIA_GALLERIES_PICASA_TYPES_H_