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 BUTTON1_CLICKED = 2, | 13 BUTTON1_CLICKED = 2, |
14 BUTTON2_CLICKED = 3, | 14 BUTTON2_CLICKED = 3, |
15 BUTTON3_CLICKED = 4, | 15 BUTTON3_CLICKED = 4, |
16 BUTTON4_CLICKED = 5, | 16 BUTTON4_CLICKED = 5, |
17 BUTTON5_CLICKED = 6, | 17 BUTTON5_CLICKED = 6, |
18 MAX = BUTTON5_CLICKED | 18 MAX = BUTTON5_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 MAX = PROGRESS |
28 }; | 28 }; |
29 | 29 |
| 30 struct ArcNotificationButton { |
| 31 // Title |
| 32 string label; |
| 33 }; |
| 34 |
30 struct ArcNotificationData { | 35 struct ArcNotificationData { |
31 // Identifier of notification | 36 // Identifier of notification |
32 string key; | 37 string key; |
33 // Type of notification | 38 // Type of notification |
34 ArcNotificationType type; | 39 ArcNotificationType type; |
35 // Body message of notification | 40 // Body message of notification |
36 string message; | 41 string message; |
37 // Title of notification | 42 // Title of notification |
38 string title; | 43 string title; |
39 // Mimetype of |icon_data| | 44 // Mimetype of |icon_data| |
40 string icon_mimetype; | 45 string icon_mimetype; |
41 // Binary data of the icon | 46 // Binary data of the icon |
42 array<uint8> icon_data; | 47 array<uint8> icon_data; |
43 // Priority of notification, must be [2,-2] | 48 // Priority of notification, must be [2,-2] |
44 int32 priority; | 49 int32 priority; |
45 // Timestamp related to the notification | 50 // Timestamp related to the notification |
46 int64 time; | 51 int64 time; |
47 // The current value of progress, must be [0, progress_max]. | 52 // The current value of progress, must be [0, progress_max]. |
48 int32 progress_current; | 53 int32 progress_current; |
49 // The maximum value of progress. | 54 // The maximum value of progress. |
50 int32 progress_max; | 55 int32 progress_max; |
| 56 // Action buttons |
| 57 array<ArcNotificationButton> buttons; |
51 }; | 58 }; |
52 | 59 |
53 interface NotificationsHost { | 60 interface NotificationsHost { |
54 // Tells the Chrome that a notification is posted (created or updated) on | 61 // Tells the Chrome that a notification is posted (created or updated) on |
55 // Android. | 62 // Android. |
56 // |notification_data| is the data of notification (id, texts, icon and ...). | 63 // |notification_data| is the data of notification (id, texts, icon and ...). |
57 OnNotificationPosted(ArcNotificationData notification_data); | 64 OnNotificationPosted(ArcNotificationData notification_data); |
58 | 65 |
59 // Notifies that a notification is removed on Android. | 66 // Notifies that a notification is removed on Android. |
60 // |key| is the identifier of the notification. | 67 // |key| is the identifier of the notification. |
61 OnNotificationRemoved(string key); | 68 OnNotificationRemoved(string key); |
62 }; | 69 }; |
63 | 70 |
64 // TODO(lhchavez): Migrate all request/response messages to Mojo. | 71 // TODO(lhchavez): Migrate all request/response messages to Mojo. |
65 interface NotificationsInstance { | 72 interface NotificationsInstance { |
66 // Establishes full-duplex communication with the host. | 73 // Establishes full-duplex communication with the host. |
67 Init(NotificationsHost host_ptr); | 74 Init(NotificationsHost host_ptr); |
68 | 75 |
69 // Sends an event from Chrome notification UI to Android. | 76 // Sends an event from Chrome notification UI to Android. |
70 // |event| is a type of occured event. | 77 // |event| is a type of occured event. |
71 SendNotificationEventToAndroid(string key, ArcNotificationEvent event); | 78 SendNotificationEventToAndroid(string key, ArcNotificationEvent event); |
72 }; | 79 }; |
OLD | NEW |