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

Side by Side Diff: components/arc/common/arc_bridge.mojom

Issue 1523643002: arc-bridge: Move most methods to Mojo interfaces (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Addressed feedback Created 5 years 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 module arc; 5 module arc;
6 6
7 // Describes the boot phase of the ARC instance, as defined by AOSP in 7 import "app.mojom";
8 // com.android.server.SystemService 8 import "input.mojom";
9 enum InstanceBootPhase { 9 import "notifications.mojom";
10 // Boot phase indicating that the instance is not running 10 import "power.mojom";
11 NOT_RUNNING = 0, 11 import "process_list.mojom";
12 12
13 // After receiving this boot phase the ARC bridge is ready to receive 13 interface ArcBridgeHost {
14 // IPC messages. This phase is ARC-specific. 14 // Notifies Chrome that the AppInstance interface is ready.
15 BRIDGE_READY, 15 OnAppInstanceReady@100(AppInstance instance_ptr);
16 16
17 // After receiving this boot phase, services can safely call into core 17 // Notifies Chrome that the InputInstnace interface is ready.
18 // system services such as the PowerManager or PackageManager. 18 OnInputInstanceReady@101(InputInstance instance_ptr);
19 SYSTEM_SERVICES_READY,
20 19
21 // After receiving this boot phase, services can broadcast Intents. 20 // Notifies Chrome that the NotificationsInstance interface is ready.
22 ACTIVITY_MANAGER_READY, 21 OnNotificationsInstanceReady@102(NotificationsInstance instance_ptr);
23 22
24 // After receiving this boot phase, services can start/bind to third party 23 // Notifies Chrome that the PowerInstance interface is ready.
25 // apps. Apps will be able to make Binder calls into services at this point. 24 OnPowerInstanceReady@103(PowerInstance instance_ptr);
26 THIRD_PARTY_APPS_CAN_START,
27 25
28 // After receiving this boot phase, services can allow user interaction 26 // Notifies Chrome that the ProcessListInstance interface is ready.
29 // with the device. This phase occurs when boot has completed and the home 27 OnProcessListInstanceReady@104(ProcessListInstance instance_ptr);
30 // application has started.
31 BOOT_COMPLETED
32 };
33
34 // Duplicates ui::ScaleFactor enum in order to be accessible on Android side.
35 enum ScaleFactor {
36 SCALE_FACTOR_NONE = 0,
37 SCALE_FACTOR_100P,
38 SCALE_FACTOR_125P,
39 SCALE_FACTOR_133P,
40 SCALE_FACTOR_140P,
41 SCALE_FACTOR_150P,
42 SCALE_FACTOR_180P,
43 SCALE_FACTOR_200P,
44 SCALE_FACTOR_250P,
45 SCALE_FACTOR_300P,
46
47 NUM_SCALE_FACTORS
48 };
49
50 // Describes ARC app.
51 struct AppInfo {
52 string name;
53 string package;
54 string activity;
55 };
56
57 // These values must be matched with the NOTIFICATION_EVENT_* constants in
58 // com.android.server.ArcNotificationListenerService.
59 enum ArcNotificationEvent {
60 BODY_CLICKED = 0,
61 CLOSED = 1,
62 // Five buttons at maximum (message_center::kNotificationMaximumItems = 5).
63 BUTTON1_CLICKED = 2,
64 BUTTON2_CLICKED = 3,
65 BUTTON3_CLICKED = 4,
66 BUTTON4_CLICKED = 5,
67 BUTTON5_CLICKED = 6,
68 };
69
70 // These values must be matched with the NOTIFICATION_TYPE_* constants in
71 // com.android.server.ArcNotificationListenerService.
72 enum ArcNotificationType {
73 BASIC = 0,
74 IMAGE = 1,
75 PROGRESS = 2,
76 };
77
78 // Enumerates the types of wake lock the ARC instance can request from the
79 // host.
80 enum DisplayWakeLockType {
81 // Does not allow the screen to dim, turn off, or lock; prevents
82 // idle suspend.
83 BRIGHT = 0,
84
85 // Allows dimming the screen, but prevents it from turning off or locking.
86 // Also prevents idle suspend.
87 DIM = 1
88 };
89
90 struct ArcNotificationData {
91 // Identifier of notification
92 string key;
93 // Type of notification
94 ArcNotificationType type;
95 // Body message of notification
96 string message;
97 // Title of notification
98 string title;
99 // Mimetype of |icon_data|
100 string icon_mimetype;
101 // Binary data of the icon
102 array<uint8> icon_data;
103 // Priority of notification, must be [2,-2]
104 int32 priority;
105 // Timestamp related to the notification
106 int64 time;
107 // The current value of progress, must be [0, progress_max].
108 int32 progress_current;
109 // The maximum value of progress.
110 int32 progress_max;
111 };
112
113 // TODO(lhchavez): Migrate all request/response messages to Mojo.
114 interface ArcBridgeHost {
115 OnInstanceBootPhase(InstanceBootPhase phase);
116
117 // Sends a list of available ARC apps to Chrome. Members of AppInfo must
118 // contain non-empty string. This message is sent in response to
119 // ArcInstanceMsg_RefreshApps message from Chrome to ARC and when ARC
120 // receives boot completed notification.
121 OnAppListRefreshed(array<AppInfo> apps);
122
123 // Sends an icon of required |scale_factor| for specific ARC app. The app is
124 // defined by |package| and |activity|. The icon content cannot be empty and
125 // must match to |scale_factor| assuming 48x48 for SCALE_FACTOR_100P.
126 // |scale_factor| is an enum defined at ui/base/layout.h. This message is
127 // sent in response to ArcInstanceMsg_RequestIcon from Chrome to ARC.
128 OnAppIcon(string package, string activity, ScaleFactor scale_factor,
129 array<uint8> icon_png_data);
130
131 // Tells the Chrome that a notification is posted (created or updated) on
132 // Android.
133 // |notification_data| is the data of notification (id, texts, icon and ...).
134 OnNotificationPosted(ArcNotificationData notification_data);
135
136 // Notifies that a notification is removed on Android.
137 // |key| is the identifier of the notification.
138 OnNotificationRemoved(string key);
139
140 // Acquire and release wake locks on the host side.
141 OnAcquireDisplayWakeLock(DisplayWakeLockType type);
142 OnReleaseDisplayWakeLock(DisplayWakeLockType type);
143 }; 28 };
144 29
145 interface ArcBridgeInstance { 30 interface ArcBridgeInstance {
146 // Establishes full-duplex communication with the host. 31 // Establishes full-duplex communication with the host.
147 // |pipe| is the MessagePipe endpoint that is bound to the ArcBridgeHostPtr 32 // |host_ptr| is the MessagePipe endpoint that is bound to the
148 // binding. 33 // ArcBridgeHostPtr binding.
149 Init(ArcBridgeHost host_ptr); 34 Init@0(ArcBridgeHost host_ptr);
150
151 // Registers a virtual input device on the container side.
152 // |name| is the device name, like "Chrome OS Keyboard".
153 // |device_type| is the device type, like "keyboard".
154 // The virtual device will be reading 'struct input_event's from |fd|. The
155 // ownership of |fd| will be transferred to the receiver, so the sender must
156 // not close it.
157 RegisterInputDevice(string name,
158 string device_type,
159 handle fd);
160
161 // Sends a request to ARC to refresh a list of ARC apps.
162 // OnRefreshAppsList is expected in response to this message. However,
163 // response may not be sent if ARC is not ready yet (boot completed event is
164 // not received).
165 RefreshAppList();
166
167 // Sends a request to ARC to launch an ARC app defined by |package| and
168 // |activity|, which cannot be empty.
169 LaunchApp(string package, string activity);
170
171 // Sends a request to ARC for the ARC app icon of a required scale factor.
172 // Scale factor is an enum defined at ui/base/layout.h. App is defined by
173 // package and activity, which cannot be empty.
174 RequestAppIcon(string package, string activity,
175 ScaleFactor scale_factor);
176
177 // Sends an event from Chrome notification UI to Android.
178 // |event| is a type of occured event.
179 SendNotificationEventToAndroid(string key, ArcNotificationEvent event);
180 }; 35 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698