Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / drive / drive.proto
1 // Copyright (c) 2012 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 // Protocol buffer definitions for representing Drive files and directories,
6 // and serializing them for the resource metadata database.
7
8 syntax = "proto2";
9
10 option optimize_for = LITE_RUNTIME;
11
12 package drive;
13
14 // Represents base::PlatformFileInfo.
15 message PlatformFileInfoProto {
16   optional int64 size = 1;
17   optional bool is_directory = 2;
18   optional bool is_symbolic_link = 3;
19   optional int64 last_modified = 4;
20   optional int64 last_accessed = 5;
21   optional int64 creation_time = 6;
22 }
23
24 // File specific info, which is a part of ResourceEntry.
25 message FileSpecificInfo {
26   // The argument with ID 1 (thumbnail_url) had been used, but got deleted.
27
28   // This URL is used for opening hosted documents with Google Drive's web
29   // interface.
30   optional string alternate_url = 2;
31
32   // Content mime type like "text/plain".
33   optional string content_mime_type = 3;
34
35   // The MD5 of contents of a regular file. Hosted files don't have MD5.
36   optional string md5 = 4;
37
38   // File extension, including the dot, used for hosted documents
39   // (ex. ".gsheet" for hosted spreadsheets).
40   optional string document_extension = 5;
41
42   // True if the file is a hosted document (i.e. document hosted on
43   // drive.google.com such as documents, spreadsheets, and presentations).
44   optional bool is_hosted_document = 6;
45
46   // The argument with ID 7 had been used, but got deleted.
47
48   // Width of the media if the file is an image.
49   optional int64 image_width = 8;
50
51   // Height of the media if the file is an image.
52   optional int64 image_height = 9;
53
54   // Rotation of the image in clockwise degrees (if an image).
55   optional int64 image_rotation = 10;
56 }
57
58 // Directory specific info, which is a part of ResourceEntry.
59 message DirectorySpecificInfo {
60   // The changestamp of this directory. This value can be larger than the
61   // changestamp of ResourceMetadata, if this directory was
62   // "fast-fetched". See crbug.com/178348 for details about the "fast-fetch"
63   // feature.
64   optional int64 changestamp = 1;
65 }
66
67 // Represents metadata of a resource (file or directory) on Drive.
68 message ResourceEntry {
69   optional PlatformFileInfoProto file_info = 1;
70   // Base name of the entry. The base name is used for file paths. Usually
71   // identical to |title|, but some extra number is inserted if multiple
72   // entries with the same title exist in the same directory, to ensure that
73   // file paths are unique. For instance, if two files titled "foo.jpg" exist
74   // in the same directory, which is allowed on drive.google.com, one of them
75   // will have a base name of "foo (2).jpg".
76   optional string base_name = 2;
77
78   // Title of the entry. See the comment at |base_name|.
79   optional string title = 3;
80
81   // Resource ID of the entry. Guaranteed to be unique.
82   optional string resource_id = 4;
83
84   // Local ID of the entry.
85   optional string local_id = 15;
86
87   // Local ID of the parent entry.
88   optional string parent_local_id = 7;
89
90   // This field is used for processing the change list from the
91   // server. Deleted entries won't be stored in ResourceMetadata.
92   optional bool deleted = 11;
93
94   // True if the entry is labeled with "shared-with-me", i.e., owned by someone
95   // else initially and later shared to the current user.
96   optional bool shared_with_me = 14;
97
98   // True if the entry is labeled "shared". Either the entry itself or its
99   // ancestor is shared (to the user from / by the user to) other accounts.
100   optional bool shared = 17;
101
102   // File specific information, such as MD5.
103   optional FileSpecificInfo file_specific_info = 9;
104
105   // Directory specific information, such as changestamp.
106   optional DirectorySpecificInfo directory_specific_info = 13;
107
108   // Used to remember whether this entry is edited locally or not.
109   enum EditState {
110     CLEAN = 0;  // No local edit.
111     DIRTY = 1;  // Edited locally.
112     SYNCING = 2;  // Local change is being synced to the server.
113   }
114
115   // Indicates whether this entry's metadata is edited locally or not.
116   optional EditState metadata_edit_state = 16;
117
118   // The time of the last modification.
119   optional int64 modification_date = 18;
120 }
121
122 // Container for the header part of ResourceMetadata.
123 message ResourceMetadataHeader {
124   // Monotonically increasing version number, which is changed when
125   // incompatible change is made to the DB format. kDBVersion in
126   // drive_resource_metadata_storage.h defines the current version.
127   optional int32 version = 1;
128   optional int64 largest_changestamp = 2;
129 }
130
131 // Message to store information of an existing cache file.
132 message FileCacheEntry {
133   // MD5 of the cache file.
134   optional string md5 = 1;
135
136   // True if the file is present locally.
137   optional bool is_present = 2;
138
139   // True if the file is pinned (i.e. available offline).
140   optional bool is_pinned = 3;
141
142   // True if the file is dirty (i.e. modified locally).
143   optional bool is_dirty = 4;
144
145   // When adding a new state, be sure to update TestFileCacheState and test
146   // functions defined in test_util.cc.
147 }