summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/push_messaging.idl
blob: 0f6917542248db1a813fd7b91b7a668a333b924d (plain)
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
// Copyright (c) 2012 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.

// Use <code>chrome.pushMessaging</code> to enable apps and extensions to
// receive message data sent through
// <a href="cloudMessaging.html">Google Cloud Messaging</a>.
namespace pushMessaging {

  dictionary Message {
    // The subchannel the message was sent on;
    // only values 0-3 are valid.
    long subchannelId;

    // The payload associated with the message, if any. This should not contain
    // any personally identifiable information.
    DOMString payload;
  };

  dictionary ChannelIdResult {
    // The channel ID for this app to use for push messaging.
    DOMString channelId;
  };

  callback ChannelIdCallback = void (ChannelIdResult channelId);

  interface Functions {
    // Retrieves the channel ID associated with this app or extension.
    // Typically an app or extension will want to send this value
    // to its application server so the server can use it
    // to trigger push messages back to the app or extension.
    // If the interactive flag is set, we will ask the user to log in
    // when they are not already logged in.
    static void getChannelId(optional boolean interactive,
                             ChannelIdCallback callback);
  };

  interface Events {
    // Fired when a push message has been received.
    // |message| : The details associated with the message.
    static void onMessage(Message message);
  };
};