- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / media_galleries / picasa_types.h
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_COMMON_MEDIA_GALLERIES_PICASA_TYPES_H_
6 #define CHROME_COMMON_MEDIA_GALLERIES_PICASA_TYPES_H_
7
8 #include <map>
9 #include <set>
10 #include <string>
11
12 #include "base/files/file_path.h"
13 #include "base/platform_file.h"
14 #include "ipc/ipc_platform_file.h"
15
16 namespace picasa {
17
18 struct AlbumInfo;
19
20 // Map of de-duplicated filenames to the platform paths for a given album.
21 // Example:
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;
31
32 extern const char kPicasaDatabaseDirName[];
33 extern const char kPicasaTempDirName[];
34 extern const char kPicasaINIFilename[];
35
36 extern const char kPicasaAlbumTableName[];
37 extern const char kAlbumTokenPrefix[];
38
39 extern const uint32 kAlbumCategoryAlbum;
40 extern const uint32 kAlbumCategoryFolder;
41 extern const uint32 kAlbumCategoryInvalid;
42
43 struct AlbumInfo {
44   AlbumInfo();
45   AlbumInfo(const std::string& name, const base::Time& timestamp,
46             const std::string& uid, const base::FilePath& path);
47
48   ~AlbumInfo();
49
50   std::string name;
51   base::Time timestamp;
52   std::string uid;
53   base::FilePath path;
54 };
55
56 struct AlbumTableFiles {
57   AlbumTableFiles();
58   explicit AlbumTableFiles(const base::FilePath& directory_path);
59
60   // Special empty file used to confirm existence of table.
61   base::PlatformFile indicator_file;
62
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;
69 };
70
71 // A mirror of AlbumTableFiles but for transit.
72 struct AlbumTableFilesForTransit {
73   AlbumTableFilesForTransit();
74   IPC::PlatformFileForTransit indicator_file;
75
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;
82 };
83
84 struct FolderINIContents {
85   base::FilePath folder_path;
86   std::string ini_contents;
87
88   bool operator<(const FolderINIContents& that) const {
89     return folder_path < that.folder_path;
90   }
91 };
92
93 void CloseAlbumTableFiles(AlbumTableFiles* table_files);
94
95 }  // namespace picasa
96
97 #endif  // CHROME_COMMON_MEDIA_GALLERIES_PICASA_TYPES_H_