summaryrefslogtreecommitdiffstats
path: root/blimp
diff options
context:
space:
mode:
authorkmarshall <kmarshall@chromium.org>2015-09-04 14:07:55 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-04 21:08:34 +0000
commitab0a1f73678c030d8a5168dc8d78ea69c9e52dba (patch)
tree0e33c593403e8461e2dde6cfbe39fcb2267e7ce4 /blimp
parent3e3068ce7d7adb8dc9db893c0cdc4b0c2ccaee66 (diff)
downloadchromium_src-ab0a1f73678c030d8a5168dc8d78ea69c9e52dba.zip
chromium_src-ab0a1f73678c030d8a5168dc8d78ea69c9e52dba.tar.gz
chromium_src-ab0a1f73678c030d8a5168dc8d78ea69c9e52dba.tar.bz2
Create structure for Blimplet client/server protocol buffers.
Includes placeholders for several feature types including Input, Compositor, and Browser Control. Add GN and GYP rules for protos. Adds interim dep from top-level build rules. Review URL: https://codereview.chromium.org/1310103003 Cr-Commit-Position: refs/heads/master@{#347488}
Diffstat (limited to 'blimp')
-rw-r--r--blimp/common/BUILD.gn1
-rw-r--r--blimp/common/proto/BUILD.gn16
-rw-r--r--blimp/common/proto/blimp_message.proto65
-rw-r--r--blimp/common/proto/client_control.proto29
-rw-r--r--blimp/common/proto/common.proto17
-rw-r--r--blimp/common/proto/compositor.proto18
-rw-r--r--blimp/common/proto/input.proto38
-rw-r--r--blimp/common/proto/server_control.proto43
8 files changed, 227 insertions, 0 deletions
diff --git a/blimp/common/BUILD.gn b/blimp/common/BUILD.gn
index 7a71c284..eaf5f16 100644
--- a/blimp/common/BUILD.gn
+++ b/blimp/common/BUILD.gn
@@ -17,6 +17,7 @@ component("blimp_common") {
deps = [
"//base",
+ "//blimp/common/proto",
"//cc",
"//skia",
"//ui/gfx/geometry",
diff --git a/blimp/common/proto/BUILD.gn b/blimp/common/proto/BUILD.gn
new file mode 100644
index 0000000..d5fc25d
--- /dev/null
+++ b/blimp/common/proto/BUILD.gn
@@ -0,0 +1,16 @@
+# Copyright 2015 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.
+
+import("//third_party/protobuf/proto_library.gni")
+
+proto_library("proto") {
+ sources = [
+ "blimp_message.proto",
+ "client_control.proto",
+ "common.proto",
+ "compositor.proto",
+ "input.proto",
+ "server_control.proto",
+ ]
+}
diff --git a/blimp/common/proto/blimp_message.proto b/blimp/common/proto/blimp_message.proto
new file mode 100644
index 0000000..9472f9e
--- /dev/null
+++ b/blimp/common/proto/blimp_message.proto
@@ -0,0 +1,65 @@
+// Copyright 2015 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.
+//
+// Contains the BlimpMessage proto which frames all messages sent over Blimp
+// subchannels. BlimpMessage protos are serialized and transmitted over the
+// wire to the Blimplet server.
+//
+// Each BlimpMessage has a few identifying fields which provide the browser
+// session and tab ID as context. The message details are stored in a
+// feature-specific field (see field IDs 1000 and onward).
+// The |type| field tells the receiving end how the BlimpMessage should
+// be unpacked and which component it should be routed to.
+//
+// CONVENTIONS:
+// * A BlimpMessage can contain only one feature message.
+// * Feature message protos are placed in their own files.
+// * Features are applied to unidirectional channels. Client->server and
+// server->client channels for a component should be broken out as distinct
+// features, even if they are conceptually similar.
+// * Shared proto types are contained in 'common.proto'.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+import "client_control.proto";
+import "compositor.proto";
+import "input.proto";
+import "server_control.proto";
+
+package blimp;
+
+message BlimpMessage {
+ enum Type {
+ COMPOSITOR = 0;
+ INPUT = 1;
+ CLIENT_CONTROL = 2;
+ SERVER_CONTROL = 3;
+ }
+ // Identifies the feature type of this message.
+ // The feature-specific contents are contained in optional fields of the same
+ // name (example: use |compositor| field for type=COMPOSITOR.)
+ optional Type type = 1;
+
+ // Uniquely identifies the Blimp session that originated this message.
+ // Session IDs are invalidated whenever new sessions are created.
+ // If a message's |session_id| does not match the client's session ID,
+ // then the message may have originated from a discarded session and can be
+ // safely ignored.
+ optional int32 session_id = 2;
+
+ // ID of the tab that is referenced by this message.
+ // Messages that are tab-agnostic may leave this field unset.
+ optional int32 target_tab_id = 3;
+
+ // Feature-specific messages follow.
+ // Only one of these fields may be set per BlimpMessage.
+ // TODO(kmarshall): use a 'oneof' union when it's supported in Chromium.
+ optional CompositorMessage compositor = 1000;
+ optional InputMessage input = 1001;
+ optional ClientControlMessage client_control = 1002;
+ optional ServerControlMessage server_control = 1003;
+}
+
diff --git a/blimp/common/proto/client_control.proto b/blimp/common/proto/client_control.proto
new file mode 100644
index 0000000..6d9f605
--- /dev/null
+++ b/blimp/common/proto/client_control.proto
@@ -0,0 +1,29 @@
+// Copyright 2015 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.
+//
+// Message definitions for client-originating browser control messages.
+//
+// Current definitions are just placeholders and are NOT final.
+// Feel free to modify this interface as necessary during feature work.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+message NavigateArgs {
+ optional string url = 1;
+}
+
+message ClientControlMessage {
+ enum Type {
+ NAVIGATE = 1;
+ STOP = 2;
+ RELOAD = 3;
+ BACK = 4;
+ FORWARD = 5;
+ }
+ optional Type type = 1;
+
+ optional NavigateArgs navigate = 1000;
+}
diff --git a/blimp/common/proto/common.proto b/blimp/common/proto/common.proto
new file mode 100644
index 0000000..578c02b
--- /dev/null
+++ b/blimp/common/proto/common.proto
@@ -0,0 +1,17 @@
+// Copyright 2015 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.
+//
+// Common message types for sharing across Blimp subprotocols.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+package blimp;
+
+message CoordinatePair {
+ optional sint32 x = 1;
+ optional sint32 y = 2;
+}
+
diff --git a/blimp/common/proto/compositor.proto b/blimp/common/proto/compositor.proto
new file mode 100644
index 0000000..bd5f826
--- /dev/null
+++ b/blimp/common/proto/compositor.proto
@@ -0,0 +1,18 @@
+// Copyright 2015 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.
+//
+// Message definitions for the compositor subprotocol.
+
+// TODO(nyquist): Import cc proto files.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+package blimp;
+
+message CompositorMessage {
+ // TODO(nyquist): Include the cc proto message here.
+}
+
diff --git a/blimp/common/proto/input.proto b/blimp/common/proto/input.proto
new file mode 100644
index 0000000..8e793e7
--- /dev/null
+++ b/blimp/common/proto/input.proto
@@ -0,0 +1,38 @@
+// Copyright 2015 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.
+//
+// Message definitions for the input subprotocol.
+//
+// Current definitions are just placeholders and are NOT final.
+// Feel free to modify this interface as necessary during feature work.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+import "common.proto";
+
+package blimp;
+
+message ClickArgs {
+ optional CoordinatePair target = 1;
+}
+
+message DragArgs {
+ optional CoordinatePair origin = 1;
+ optional CoordinatePair destination = 2;
+ optional CoordinatePair elastic_overscroll = 3;
+}
+
+message InputMessage {
+ enum Type {
+ CLICK = 1;
+ DRAG = 2;
+ }
+ optional Type type = 1;
+
+ optional ClickArgs click = 1000;
+ optional DragArgs drag = 1001;
+}
+
diff --git a/blimp/common/proto/server_control.proto b/blimp/common/proto/server_control.proto
new file mode 100644
index 0000000..f1cf976
--- /dev/null
+++ b/blimp/common/proto/server_control.proto
@@ -0,0 +1,43 @@
+// Copyright 2015 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.
+//
+// Message definitions for server-originating browser control messages.
+//
+// Current definitions are just placeholders and are NOT final.
+// Feel free to modify this interface as necessary during feature work.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+message StatusArgs {
+ optional string url = 1;
+ optional int32 loading_progress = 2;
+ // Add error code, error message, status strings, etc.
+}
+
+message ResetSessionArgs {
+}
+
+message ErrorArgs {
+ enum ErrorCode {
+ UNKNOWN = 1;
+ UNRESPONSIVE = 2;
+ SERVER_ERROR = 3;
+ }
+
+ optional ErrorCode error_code = 1;
+ optional int32 server_error_code = 2;
+}
+
+message ServerControlMessage {
+ enum Type {
+ ERROR = 1;
+ STATUS = 2;
+ }
+ optional Type type = 1;
+
+ optional ErrorArgs error = 1000;
+ optional StatusArgs status = 1001;
+}