Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Side by Side Diff: blimp/common/proto/blimp_message.proto

Issue 1933053003: Used oneof in blimp_message.proto (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 17 matching lines...) Expand all
28 import "input.proto"; 28 import "input.proto";
29 import "navigation.proto"; 29 import "navigation.proto";
30 import "render_widget.proto"; 30 import "render_widget.proto";
31 import "protocol_control.proto"; 31 import "protocol_control.proto";
32 import "settings.proto"; 32 import "settings.proto";
33 import "tab_control.proto"; 33 import "tab_control.proto";
34 34
35 package blimp; 35 package blimp;
36 36
37 message BlimpMessage { 37 message BlimpMessage {
38 enum Type {
39 UNKNOWN = 0;
40 TAB_CONTROL = 1;
41 NAVIGATION = 2;
42 RENDER_WIDGET = 3;
43 INPUT = 4;
44 COMPOSITOR = 5;
45 PROTOCOL_CONTROL = 6;
46 IME = 7;
47 SETTINGS = 8;
48 }
49
50 // Sequence number of this message, used for message acknowledgement. 38 // Sequence number of this message, used for message acknowledgement.
51 // The sender may omit this value if it is exactly one higher than the 39 // The sender may omit this value if it is exactly one higher than the
52 // message that was previously sent. 40 // message that was previously sent.
53 optional int64 message_id = 1; 41 optional int64 message_id = 1;
54 42
55 // Identifies the feature type of this message.
56 // The feature-specific contents are contained in optional fields of the same
57 // name (example: use |compositor| field for type=COMPOSITOR.)
58 optional Type type = 2;
59
60 // Uniquely identifies the Blimp session that originated this message. 43 // Uniquely identifies the Blimp session that originated this message.
61 // Session IDs are invalidated whenever new sessions are created. 44 // Session IDs are invalidated whenever new sessions are created.
62 // If a message's |session_id| does not match the client's session ID, 45 // If a message's |session_id| does not match the client's session ID,
63 // then the message may have originated from a discarded session and can be 46 // then the message may have originated from a discarded session and can be
64 // safely ignored. 47 // safely ignored.
65 optional int32 session_id = 3; 48 optional int32 session_id = 3;
66 49
67 // ID of the tab that is referenced by this message. 50 // ID of the tab that is referenced by this message.
68 // Messages that are tab-agnostic may leave this field unset. 51 // Messages that are tab-agnostic may leave this field unset.
69 optional int32 target_tab_id = 4; 52 optional int32 target_tab_id = 4;
70 53
71 // Feature-specific messages follow. 54 // Feature-specific messages follow.
72 // Only one of these fields may be set per BlimpMessage. 55 oneof feature {
73 // TODO(kmarshall): use a 'oneof' union when it's supported in Chromium. See 56 TabControlMessage tab_control = 1000;
74 // crbug.com/570371. 57 NavigationMessage navigation = 1001;
75 optional TabControlMessage tab_control = 1000; 58 RenderWidgetMessage render_widget = 1002;
76 optional NavigationMessage navigation = 1001; 59 InputMessage input = 1003;
77 optional RenderWidgetMessage render_widget = 1002; 60 CompositorMessage compositor = 1004;
78 optional InputMessage input = 1003; 61 ProtocolControlMessage protocol_control = 1005;
79 optional CompositorMessage compositor = 1004; 62 ImeMessage ime = 1006;
80 optional ProtocolControlMessage protocol_control = 1005; 63 SettingsMessage settings = 1007;
81 optional ImeMessage ime = 1006; 64 }
82 optional SettingsMessage settings = 1007;
83 } 65 }
84 66
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698