summaryrefslogtreecommitdiffstats
path: root/components/drive
diff options
context:
space:
mode:
authorlukasza <lukasza@chromium.org>2015-07-21 08:19:25 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-21 15:20:07 +0000
commit01b9d55a31083aa9d48b9fc2e85cbc4038623a9e (patch)
tree0a5adb2f8e885caffc52474519d802cec90bde7f /components/drive
parent24aaf9fed177a7e5f65b84d5c113f56f04b617ef (diff)
downloadchromium_src-01b9d55a31083aa9d48b9fc2e85cbc4038623a9e.zip
chromium_src-01b9d55a31083aa9d48b9fc2e85cbc4038623a9e.tar.gz
chromium_src-01b9d55a31083aa9d48b9fc2e85cbc4038623a9e.tar.bz2
Move chrome/browser/chromeos/drive/drive.proto into components/drive
Changes of include paths under chrome/browser/chromeos/extensions are purely mechanical and therefore I am using tbr for them. TBR=kalman@chromium.org BUG=257943, 498951 Review URL: https://codereview.chromium.org/1243853002 Cr-Commit-Position: refs/heads/master@{#339653}
Diffstat (limited to 'components/drive')
-rw-r--r--components/drive/BUILD.gn12
-rw-r--r--components/drive/drive.proto170
2 files changed, 182 insertions, 0 deletions
diff --git a/components/drive/BUILD.gn b/components/drive/BUILD.gn
index 64f3141..f3f91c4 100644
--- a/components/drive/BUILD.gn
+++ b/components/drive/BUILD.gn
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//third_party/protobuf/proto_library.gni")
+
source_set("drive") {
sources = [
"drive_api_util.cc",
@@ -36,6 +38,16 @@ source_set("drive") {
"//third_party/re2:re2",
]
+ public_deps = [
+ ":proto",
+ ]
+}
+
+proto_library("proto") {
+ visibility = [ ":drive" ]
+ sources = [
+ "drive.proto",
+ ]
}
source_set("test_support") {
diff --git a/components/drive/drive.proto b/components/drive/drive.proto
new file mode 100644
index 0000000..7a99598
--- /dev/null
+++ b/components/drive/drive.proto
@@ -0,0 +1,170 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Protocol buffer definitions for representing Drive files and directories,
+// and serializing them for the resource metadata database.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+package drive;
+
+// Represents base::PlatformFileInfo.
+message PlatformFileInfoProto {
+ optional int64 size = 1;
+ optional bool is_directory = 2;
+ optional bool is_symbolic_link = 3;
+ optional int64 last_modified = 4;
+ optional int64 last_accessed = 5;
+ optional int64 creation_time = 6;
+}
+
+// Represents a property for a file.
+message Property {
+ optional string key = 1;
+ optional string value = 2;
+
+ // Visibility of the property. Either restricted to the same client, or
+ // public.
+ enum Visibility {
+ PRIVATE = 0;
+ PUBLIC = 1;
+ }
+
+ optional Visibility visibility = 3;
+}
+
+// File specific info, which is a part of ResourceEntry.
+message FileSpecificInfo {
+ // The argument with ID 1 (thumbnail_url) had been used, but got deleted.
+
+ // This URL is used for opening hosted documents with Google Drive's web
+ // interface.
+ optional string alternate_url = 2;
+
+ // Content mime type like "text/plain".
+ optional string content_mime_type = 3;
+
+ // The MD5 of contents of a regular file. Hosted files don't have MD5.
+ optional string md5 = 4;
+
+ // File extension, including the dot, used for hosted documents
+ // (ex. ".gsheet" for hosted spreadsheets).
+ optional string document_extension = 5;
+
+ // True if the file is a hosted document (i.e. document hosted on
+ // drive.google.com such as documents, spreadsheets, and presentations).
+ optional bool is_hosted_document = 6;
+
+ // The argument with ID 7 had been used, but got deleted.
+
+ // Width of the media if the file is an image.
+ optional int64 image_width = 8;
+
+ // Height of the media if the file is an image.
+ optional int64 image_height = 9;
+
+ // Rotation of the image in clockwise degrees (if an image).
+ optional int64 image_rotation = 10;
+
+ // Cache related states.
+ optional FileCacheEntry cache_state = 11;
+}
+
+// Directory specific info, which is a part of ResourceEntry.
+message DirectorySpecificInfo {
+ // The changestamp of this directory. This value can be larger than the
+ // changestamp of ResourceMetadata, if this directory was
+ // "fast-fetched". See crbug.com/178348 for details about the "fast-fetch"
+ // feature.
+ optional int64 changestamp = 1;
+}
+
+// Represents metadata of a resource (file or directory) on Drive.
+message ResourceEntry {
+ optional PlatformFileInfoProto file_info = 1;
+ // Base name of the entry. The base name is used for file paths. Usually
+ // identical to |title|, but some extra number is inserted if multiple
+ // entries with the same title exist in the same directory, to ensure that
+ // file paths are unique. For instance, if two files titled "foo.jpg" exist
+ // in the same directory, which is allowed on drive.google.com, one of them
+ // will have a base name of "foo (2).jpg".
+ optional string base_name = 2;
+
+ // Title of the entry. See the comment at |base_name|.
+ optional string title = 3;
+
+ // Resource ID of the entry. Guaranteed to be unique.
+ optional string resource_id = 4;
+
+ // Local ID of the entry.
+ optional string local_id = 15;
+
+ // Local ID of the parent entry.
+ optional string parent_local_id = 7;
+
+ // This field is used for processing the change list from the
+ // server. Deleted entries won't be stored in ResourceMetadata.
+ optional bool deleted = 11;
+
+ // True if the entry is labeled with "shared-with-me", i.e., owned by someone
+ // else initially and later shared to the current user.
+ optional bool shared_with_me = 14;
+
+ // True if the entry is labeled "shared". Either the entry itself or its
+ // ancestor is shared (to the user from / by the user to) other accounts.
+ optional bool shared = 17;
+
+ // File specific information, such as MD5.
+ optional FileSpecificInfo file_specific_info = 9;
+
+ // Directory specific information, such as changestamp.
+ optional DirectorySpecificInfo directory_specific_info = 13;
+
+ // Used to remember whether this entry is edited locally or not.
+ enum EditState {
+ CLEAN = 0; // No local edit.
+ DIRTY = 1; // Edited locally.
+ SYNCING = 2; // Local change is being synced to the server.
+ }
+
+ // Indicates whether this entry's metadata is edited locally or not.
+ optional EditState metadata_edit_state = 16;
+
+ // The time of the last modification.
+ optional int64 modification_date = 18;
+
+ // List of new properties which are not synced yet via Drive API. Note, that
+ // currently existing properties are never fetched via Drive API, as they are
+ // never used. That would cause growing the proto size for no reason.
+ repeated Property new_properties = 19;
+}
+
+// Container for the header part of ResourceMetadata.
+message ResourceMetadataHeader {
+ // Monotonically increasing version number, which is changed when
+ // incompatible change is made to the DB format. kDBVersion in
+ // drive_resource_metadata_storage.h defines the current version.
+ optional int32 version = 1;
+ optional int64 largest_changestamp = 2;
+}
+
+// Message to store information of an existing cache file.
+message FileCacheEntry {
+ // MD5 of the cache file.
+ optional string md5 = 1;
+
+ // True if the file is present locally.
+ optional bool is_present = 2;
+
+ // True if the file is pinned (i.e. available offline).
+ optional bool is_pinned = 3;
+
+ // True if the file is dirty (i.e. modified locally).
+ optional bool is_dirty = 4;
+
+ // When adding a new state, be sure to update TestFileCacheState and test
+ // functions defined in test_util.cc.
+}