| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // Contains the BlimpMessage proto which frames all messages sent over Blimp | 5 // Contains the BlimpMessage proto which frames all messages sent over Blimp |
| 6 // subchannels. BlimpMessage protos are serialized and transmitted over the | 6 // subchannels. BlimpMessage protos are serialized and transmitted over the |
| 7 // wire to the Blimplet server. | 7 // wire to the Blimplet server. |
| 8 // | 8 // |
| 9 // Each BlimpMessage has a few identifying fields which provide the browser | 9 // Each BlimpMessage has a few identifying fields which provide the browser |
| 10 // session and tab ID as context. The message details are stored in a | 10 // session and tab ID as context. The message details are stored in a |
| 11 // feature-specific field (see field IDs 1000 and onward). | 11 // feature-specific field (see field IDs 1000 and onward). |
| 12 // The |type| field tells the receiving end how the BlimpMessage should | 12 // The |type| field tells the receiving end how the BlimpMessage should |
| 13 // be unpacked and which component it should be routed to. | 13 // be unpacked and which component it should be routed to. |
| 14 // | 14 // |
| 15 // CONVENTIONS: | 15 // CONVENTIONS: |
| 16 // * A BlimpMessage can contain only one feature message. | 16 // * A BlimpMessage can contain only one feature message. |
| 17 // * Feature message protos are placed in their own files. | 17 // * Feature message protos are placed in their own files. |
| 18 // * Features are applied to unidirectional channels. Client->server and | 18 // * Features are applied to unidirectional channels. Client->server and |
| 19 // server->client channels for a component should be broken out as distinct | 19 // server->client channels for a component should be broken out as distinct |
| 20 // features, even if they are conceptually similar. | 20 // features, even if they are conceptually similar. |
| 21 // * Shared proto types are contained in 'common.proto'. | |
| 22 | 21 |
| 23 syntax = "proto2"; | 22 syntax = "proto2"; |
| 24 | 23 |
| 25 option optimize_for = LITE_RUNTIME; | 24 option optimize_for = LITE_RUNTIME; |
| 26 | 25 |
| 27 import "control.proto"; | 26 import "control.proto"; |
| 28 import "compositor.proto"; | 27 import "compositor.proto"; |
| 29 import "input.proto"; | 28 import "input.proto"; |
| 30 import "navigation.proto"; | 29 import "navigation.proto"; |
| 30 import "render_widget.proto"; |
| 31 | 31 |
| 32 package blimp; | 32 package blimp; |
| 33 | 33 |
| 34 message BlimpMessage { | 34 message BlimpMessage { |
| 35 enum Type { | 35 enum Type { |
| 36 COMPOSITOR = 0; | 36 CONTROL = 0; |
| 37 INPUT = 1; | 37 NAVIGATION = 1; |
| 38 CONTROL = 2; | 38 RENDER_WIDGET = 2; |
| 39 NAVIGATION = 3; | 39 INPUT = 3; |
| 40 COMPOSITOR = 4; |
| 40 } | 41 } |
| 41 // Identifies the feature type of this message. | 42 // Identifies the feature type of this message. |
| 42 // The feature-specific contents are contained in optional fields of the same | 43 // The feature-specific contents are contained in optional fields of the same |
| 43 // name (example: use |compositor| field for type=COMPOSITOR.) | 44 // name (example: use |compositor| field for type=COMPOSITOR.) |
| 44 optional Type type = 1; | 45 optional Type type = 1; |
| 45 | 46 |
| 46 // Uniquely identifies the Blimp session that originated this message. | 47 // Uniquely identifies the Blimp session that originated this message. |
| 47 // Session IDs are invalidated whenever new sessions are created. | 48 // Session IDs are invalidated whenever new sessions are created. |
| 48 // If a message's |session_id| does not match the client's session ID, | 49 // If a message's |session_id| does not match the client's session ID, |
| 49 // then the message may have originated from a discarded session and can be | 50 // then the message may have originated from a discarded session and can be |
| 50 // safely ignored. | 51 // safely ignored. |
| 51 optional int32 session_id = 2; | 52 optional int32 session_id = 2; |
| 52 | 53 |
| 53 // ID of the tab that is referenced by this message. | 54 // ID of the tab that is referenced by this message. |
| 54 // Messages that are tab-agnostic may leave this field unset. | 55 // Messages that are tab-agnostic may leave this field unset. |
| 55 optional int32 target_tab_id = 3; | 56 optional int32 target_tab_id = 3; |
| 56 | 57 |
| 57 // Feature-specific messages follow. | 58 // Feature-specific messages follow. |
| 58 // Only one of these fields may be set per BlimpMessage. | 59 // Only one of these fields may be set per BlimpMessage. |
| 59 // TODO(kmarshall): use a 'oneof' union when it's supported in Chromium. | 60 // TODO(kmarshall): use a 'oneof' union when it's supported in Chromium. |
| 60 optional CompositorMessage compositor = 1000; | 61 optional ControlMessage control = 1000; |
| 61 optional InputMessage input = 1001; | 62 optional NavigationMessage navigation = 1001; |
| 62 optional ControlMessage control = 1002; | 63 optional RenderWidgetMessage render_widget = 1002; |
| 63 optional NavigationMessage navigation = 1003; | 64 optional InputMessage input = 1003; |
| 65 optional CompositorMessage compositor = 1004; |
| 64 } | 66 } |
| 65 | 67 |
| OLD | NEW |