• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4
5// Use <code>chrome.pushMessaging</code> to enable apps and extensions to
6// receive message data sent through
7// <a href="cloudMessaging.html">Google Cloud Messaging</a>.
8namespace pushMessaging {
9
10  dictionary Message {
11    // The subchannel the message was sent on;
12    // only values 0-3 are valid.
13    long subchannelId;
14
15    // The payload associated with the message, if any. This should not contain
16    // any personally identifiable information.
17    DOMString payload;
18  };
19
20  dictionary ChannelIdResult {
21    // The channel ID for this app to use for push messaging.
22    DOMString channelId;
23  };
24
25  callback ChannelIdCallback = void (ChannelIdResult channelId);
26
27  interface Functions {
28    // Retrieves the channel ID associated with this app or extension.
29    // Typically an app or extension will want to send this value
30    // to its application server so the server can use it
31    // to trigger push messages back to the app or extension.
32    // If the interactive flag is set, we will ask the user to log in
33    // when they are not already logged in.
34    static void getChannelId(optional boolean interactive,
35                             ChannelIdCallback callback);
36  };
37
38  interface Events {
39    // Fired when a push message has been received.
40    // |message| : The details associated with the message.
41    static void onMessage(Message message);
42  };
43};
44