New push messaging introduction to API docs.
[chromium-blink-merge.git] / chrome / common / extensions / api / push_messaging.idl
blob0d81b43678d0efb2244f0dc20955a61f026f21e7
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 namespace pushMessaging{
7 dictionary Message {
8 // The subchannel the message was sent on;
9 // only values 0-3 are valid.
10 long subchannelId;
12 // The payload associated with the message, if any.
13 DOMString payload;
16 dictionary ChannelIdResult {
17 // The channel ID for this app to use for push messaging.
18 DOMString channelId;
21 callback ChannelIdCallback = void (ChannelIdResult channelId);
23 interface Functions {
24 // Retrieves the channel ID associated with this app or extension.
25 // Typically an app or extension will want to send this value
26 // to its application server so the server can use it
27 // to trigger push messages back to the app or extension.
28 // If the interactive flag is set, we will ask the user to log in
29 // when they are not already logged in.
30 static void getChannelId(optional boolean interactive,
31 ChannelIdCallback callback);
34 interface Events {
35 // Fired when a push message has been received.
36 // |message| : The details associated with the message.
37 static void onMessage(Message message);