1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module arc;
// These values must be matched with the NOTIFICATION_EVENT_* constants in
// com.android.server.ArcNotificationListenerService.
enum ArcNotificationEvent {
BODY_CLICKED = 0,
CLOSED = 1,
// Five buttons at maximum (message_center::kNotificationMaximumItems = 5).
BUTTON_1_CLICKED = 2,
BUTTON_2_CLICKED = 3,
BUTTON_3_CLICKED = 4,
BUTTON_4_CLICKED = 5,
BUTTON_5_CLICKED = 6,
MAX = BUTTON_5_CLICKED
};
// These values must be matched with the NOTIFICATION_TYPE_* constants in
// com.android.server.ArcNotificationListenerService.
enum ArcNotificationType {
BASIC = 0,
IMAGE = 1,
PROGRESS = 2,
MAX = PROGRESS
};
struct ArcNotificationButton {
// Title
string label;
};
struct ArcNotificationData {
// Identifier of notification
string key;
// Type of notification
ArcNotificationType type;
// Body message of notification
string message;
// Title of notification
string title;
// Mimetype of |icon_data|
string icon_mimetype;
// Binary data of the icon
array<uint8> icon_data;
// Priority of notification, must be [2,-2]
int32 priority;
// Timestamp related to the notification
int64 time;
// The current value of progress, must be [0, progress_max].
int32 progress_current;
// The maximum value of progress.
int32 progress_max;
// Action buttons
array<ArcNotificationButton> buttons;
// Flag if the notification has FLAG_NO_CLEAR.
[MinVersion=1]
bool no_clear;
// Flag if the notification has FLAG_ONGOING_EVENT.
[MinVersion=1]
bool ongoing_event;
};
[MinVersion=2]
struct ArcToastData {
// Unique identifier
string id;
// Toast text.
string text;
// Toast duration in milliseconds.
int32 duration;
};
interface NotificationsHost {
// Tells the Chrome that a notification is posted (created or updated) on
// Android.
// |notification_data| is the data of notification (id, texts, icon and ...).
OnNotificationPosted@0(ArcNotificationData notification_data);
// Notifies that a notification is removed on Android.
// |key| is the identifier of the notification.
OnNotificationRemoved@1(string key);
[MinVersion=2]
// Shows a toast, or queues it if another toast is visible.
OnToastPosted@2(ArcToastData data);
[MinVersion=2]
// Hides the visible toast immediately, or cancels the scheduled one.
OnToastCancelled@3(ArcToastData data);
};
// TODO(lhchavez): Migrate all request/response messages to Mojo.
interface NotificationsInstance {
// Establishes full-duplex communication with the host.
Init(NotificationsHost host_ptr);
// Sends an event from Chrome notification UI to Android.
// |event| is a type of occured event.
SendNotificationEventToAndroid(string key, ArcNotificationEvent event);
};
|