Upstream version 7.36.149.0
[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.h"
13 #include "base/files/file_path.h"
14 #include "base/move.h"
15 #include "ipc/ipc_platform_file.h"
16
17 namespace picasa {
18
19 struct AlbumInfo;
20
21 // Map of de-duplicated filenames to the platform paths for a given album.
22 // Example:
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;
32
33 extern const char kPicasaDatabaseDirName[];
34 extern const char kPicasaTempDirName[];
35 extern const char kPicasaINIFilename[];
36
37 extern const char kPicasaAlbumTableName[];
38 extern const char kAlbumTokenPrefix[];
39
40 extern const uint32 kAlbumCategoryAlbum;
41 extern const uint32 kAlbumCategoryFolder;
42 extern const uint32 kAlbumCategoryInvalid;
43
44 struct AlbumInfo {
45   AlbumInfo();
46   AlbumInfo(const std::string& name, const base::Time& timestamp,
47             const std::string& uid, const base::FilePath& path);
48
49   ~AlbumInfo();
50
51   std::string name;
52   base::Time timestamp;
53   std::string uid;
54   base::FilePath path;
55 };
56
57 struct AlbumTableFiles {
58   MOVE_ONLY_TYPE_FOR_CPP_03(AlbumTableFiles, RValue)
59  public:
60   AlbumTableFiles();
61   explicit AlbumTableFiles(const base::FilePath& directory_path);
62   ~AlbumTableFiles();
63
64   // C++03 move emulation of this type.
65   AlbumTableFiles(RValue other);
66   AlbumTableFiles& operator=(RValue other);
67
68   // Special empty file used to confirm existence of table.
69   base::File indicator_file;
70
71   base::File category_file;
72   base::File date_file;
73   base::File filename_file;
74   base::File name_file;
75   base::File token_file;
76   base::File uid_file;
77 };
78
79 // A mirror of AlbumTableFiles but for transit.
80 struct AlbumTableFilesForTransit {
81   AlbumTableFilesForTransit();
82   IPC::PlatformFileForTransit indicator_file;
83
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;
90 };
91
92 struct FolderINIContents {
93   base::FilePath folder_path;
94   std::string ini_contents;
95
96   bool operator<(const FolderINIContents& that) const {
97     return folder_path < that.folder_path;
98   }
99 };
100
101 }  // namespace picasa
102
103 #endif  // CHROME_COMMON_MEDIA_GALLERIES_PICASA_TYPES_H_