Chromium Code Reviews| 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 module arc; | 5 module arc; |
| 6 | 6 |
| 7 // These values must be matched with the NOTIFICATION_EVENT_* constants in | 7 // These values must be matched with the NOTIFICATION_EVENT_* constants in |
| 8 // com.android.server.ArcNotificationListenerService. | 8 // com.android.server.ArcNotificationListenerService. |
| 9 enum ArcNotificationEvent { | 9 enum ArcNotificationEvent { |
| 10 BODY_CLICKED = 0, | 10 BODY_CLICKED = 0, |
| 11 CLOSED = 1, | 11 CLOSED = 1, |
| 12 // Five buttons at maximum (message_center::kNotificationMaximumItems = 5). | 12 // Five buttons at maximum (message_center::kNotificationMaximumItems = 5). |
| 13 BUTTON_1_CLICKED = 2, | 13 BUTTON_1_CLICKED = 2, |
| 14 BUTTON_2_CLICKED = 3, | 14 BUTTON_2_CLICKED = 3, |
| 15 BUTTON_3_CLICKED = 4, | 15 BUTTON_3_CLICKED = 4, |
| 16 BUTTON_4_CLICKED = 5, | 16 BUTTON_4_CLICKED = 5, |
| 17 BUTTON_5_CLICKED = 6, | 17 BUTTON_5_CLICKED = 6, |
| 18 MAX = BUTTON_5_CLICKED | 18 MAX = BUTTON_5_CLICKED |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 // These values must be matched with the NOTIFICATION_TYPE_* constants in | 21 // These values must be matched with the NOTIFICATION_TYPE_* constants in |
| 22 // com.android.server.ArcNotificationListenerService. | 22 // com.android.server.ArcNotificationListenerService. |
| 23 enum ArcNotificationType { | 23 enum ArcNotificationType { |
| 24 BASIC = 0, | 24 BASIC = 0, |
| 25 IMAGE = 1, | 25 IMAGE = 1, |
| 26 PROGRESS = 2, | 26 PROGRESS = 2, |
| 27 MAX = PROGRESS | 27 LIST = 3, |
| 28 MAX = LIST | |
|
dcheng
2016/04/13 23:55:20
I don't think MAX serves a purpose in mojo
yoshiki
2016/04/15 00:32:34
Done.
| |
| 28 }; | 29 }; |
| 29 | 30 |
| 30 struct ArcNotificationButton { | 31 struct ArcNotificationButton { |
| 31 // Title | 32 // Title |
| 32 string label; | 33 string label; |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 struct ArcNotificationData { | 36 struct ArcNotificationData { |
| 36 // Identifier of notification | 37 // Identifier of notification |
| 37 string key; | 38 string key; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 54 // The maximum value of progress. | 55 // The maximum value of progress. |
| 55 int32 progress_max; | 56 int32 progress_max; |
| 56 // Action buttons | 57 // Action buttons |
| 57 array<ArcNotificationButton> buttons; | 58 array<ArcNotificationButton> buttons; |
| 58 // Flag if the notification has FLAG_NO_CLEAR. | 59 // Flag if the notification has FLAG_NO_CLEAR. |
| 59 [MinVersion=1] | 60 [MinVersion=1] |
| 60 bool no_clear; | 61 bool no_clear; |
| 61 // Flag if the notification has FLAG_ONGOING_EVENT. | 62 // Flag if the notification has FLAG_ONGOING_EVENT. |
| 62 [MinVersion=1] | 63 [MinVersion=1] |
| 63 bool ongoing_event; | 64 bool ongoing_event; |
| 65 // Subtexts for list notifications. | |
| 66 [MinVersion=3] | |
| 67 array<string>? texts; | |
| 68 // Image for image notifications. | |
| 69 [MinVersion=3] | |
| 70 ArcNotificationBitmap? big_picture; | |
| 64 }; | 71 }; |
| 65 | 72 |
| 66 [MinVersion=2] | 73 [MinVersion=2] |
| 67 struct ArcToastData { | 74 struct ArcToastData { |
| 68 // Unique identifier | 75 // Unique identifier |
| 69 string id; | 76 string id; |
| 70 // Toast text. | 77 // Toast text. |
| 71 string text; | 78 string text; |
| 72 // Toast duration in milliseconds. | 79 // Toast duration in milliseconds. |
| 73 int32 duration; | 80 int32 duration; |
| 74 }; | 81 }; |
| 75 | 82 |
| 83 [MinVersion=3] | |
| 84 struct ArcNotificationBitmap { | |
| 85 uint32 width; | |
| 86 uint32 height; | |
| 87 array<uint8> pixel_data; | |
| 88 }; | |
| 89 | |
| 76 interface NotificationsHost { | 90 interface NotificationsHost { |
| 77 // Tells the Chrome that a notification is posted (created or updated) on | 91 // Tells the Chrome that a notification is posted (created or updated) on |
| 78 // Android. | 92 // Android. |
| 79 // |notification_data| is the data of notification (id, texts, icon and ...). | 93 // |notification_data| is the data of notification (id, texts, icon and ...). |
| 80 OnNotificationPosted@0(ArcNotificationData notification_data); | 94 OnNotificationPosted@0(ArcNotificationData notification_data); |
| 81 | 95 |
| 82 // Notifies that a notification is removed on Android. | 96 // Notifies that a notification is removed on Android. |
| 83 // |key| is the identifier of the notification. | 97 // |key| is the identifier of the notification. |
| 84 OnNotificationRemoved@1(string key); | 98 OnNotificationRemoved@1(string key); |
| 85 | 99 |
| 86 [MinVersion=2] | 100 [MinVersion=2] |
| 87 // Shows a toast, or queues it if another toast is visible. | 101 // Shows a toast, or queues it if another toast is visible. |
| 88 OnToastPosted@2(ArcToastData data); | 102 OnToastPosted@2(ArcToastData data); |
| 89 | 103 |
| 90 [MinVersion=2] | 104 [MinVersion=2] |
| 91 // Hides the visible toast immediately, or cancels the scheduled one. | 105 // Hides the visible toast immediately, or cancels the scheduled one. |
| 92 OnToastCancelled@3(ArcToastData data); | 106 OnToastCancelled@3(ArcToastData data); |
| 93 }; | 107 }; |
| 94 | 108 |
| 95 // TODO(lhchavez): Migrate all request/response messages to Mojo. | 109 // TODO(lhchavez): Migrate all request/response messages to Mojo. |
| 96 interface NotificationsInstance { | 110 interface NotificationsInstance { |
| 97 // Establishes full-duplex communication with the host. | 111 // Establishes full-duplex communication with the host. |
| 98 Init(NotificationsHost host_ptr); | 112 Init(NotificationsHost host_ptr); |
| 99 | 113 |
| 100 // Sends an event from Chrome notification UI to Android. | 114 // Sends an event from Chrome notification UI to Android. |
| 101 // |event| is a type of occured event. | 115 // |event| is a type of occured event. |
| 102 SendNotificationEventToAndroid(string key, ArcNotificationEvent event); | 116 SendNotificationEventToAndroid(string key, ArcNotificationEvent event); |
| 103 }; | 117 }; |
| OLD | NEW |