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.h"
13 #include "base/files/file_path.h"
14 #include "base/move.h"
15 #include "ipc/ipc_platform_file.h"
21 // Map of de-duplicated filenames to the platform paths for a given album.
23 // Bar.jpg -> /path/to/Bar.jpg
24 // Foo.jpg -> /path/to/Foo.jpg
25 // Foo (1).jpg -> /path/to/another/Foo.jpg
26 // TODO(tommycli): Rename this type to a more intuitive name.
27 typedef std::map<std::string, base::FilePath> AlbumImages;
28 typedef std::set<std::string> AlbumUIDSet;
29 // Map of album uids to a collection of its images.
30 typedef std::map<std::string, AlbumImages> AlbumImagesMap;
31 typedef std::map<std::string, AlbumInfo> AlbumMap;
33 extern const char kPicasaDatabaseDirName[];
34 extern const char kPicasaTempDirName[];
35 extern const char kPicasaINIFilename[];
37 extern const char kPicasaAlbumTableName[];
38 extern const char kAlbumTokenPrefix[];
40 extern const uint32 kAlbumCategoryAlbum;
41 extern const uint32 kAlbumCategoryFolder;
42 extern const uint32 kAlbumCategoryInvalid;
46 AlbumInfo(const std::string& name, const base::Time& timestamp,
47 const std::string& uid, const base::FilePath& path);
57 struct AlbumTableFiles {
58 MOVE_ONLY_TYPE_FOR_CPP_03(AlbumTableFiles, RValue)
61 explicit AlbumTableFiles(const base::FilePath& directory_path);
64 // C++03 move emulation of this type.
65 AlbumTableFiles(RValue other);
66 AlbumTableFiles& operator=(RValue other);
68 // Special empty file used to confirm existence of table.
69 base::File indicator_file;
71 base::File category_file;
73 base::File filename_file;
75 base::File token_file;
79 // A mirror of AlbumTableFiles but for transit.
80 struct AlbumTableFilesForTransit {
81 AlbumTableFilesForTransit();
82 IPC::PlatformFileForTransit indicator_file;
84 IPC::PlatformFileForTransit category_file;
85 IPC::PlatformFileForTransit date_file;
86 IPC::PlatformFileForTransit filename_file;
87 IPC::PlatformFileForTransit name_file;
88 IPC::PlatformFileForTransit token_file;
89 IPC::PlatformFileForTransit uid_file;
92 struct FolderINIContents {
93 base::FilePath folder_path;
94 std::string ini_contents;
96 bool operator<(const FolderINIContents& that) const {
97 return folder_path < that.folder_path;
101 } // namespace picasa
103 #endif // CHROME_COMMON_MEDIA_GALLERIES_PICASA_TYPES_H_