OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 var chrome = chrome || {}; | 5 var chrome = chrome || {}; |
6 (function() { | 6 (function() { |
7 native function GetChromeHidden(); | 7 native function GetChromeHidden(); |
8 native function GetIsInstalled(); | 8 native function GetIsInstalled(); |
9 native function Install(); | 9 native function Install(); |
10 native function GetDetails(); | 10 native function GetDetails(); |
11 native function GetDetailsForFrame(); | 11 native function GetDetailsForFrame(); |
12 native function GetAppNotifyChannel(); | 12 native function GetAppNotifyChannel(); |
13 | 13 |
14 var chromeHidden = GetChromeHidden(); | 14 var chromeHidden = GetChromeHidden(); |
15 var callbacks = {}; | 15 var callbacks = {}; |
16 var nextCallbackId = 1; | 16 var nextCallbackId = 1; |
17 | 17 |
18 chrome.app = new function() { | 18 chrome.app = new function() { |
19 this.__defineGetter__('isInstalled', GetIsInstalled); | 19 this.__defineGetter__('isInstalled', GetIsInstalled); |
20 this.install = Install; | 20 this.install = Install; |
21 this.getDetails = GetDetails; | 21 this.getDetails = GetDetails; |
22 this.getDetailsForFrame = GetDetailsForFrame; | 22 this.getDetailsForFrame = GetDetailsForFrame; |
23 this.experimental = { | 23 }(); |
24 getNotificationChannel: function(clientId, callback) { | 24 |
25 var callbackId = 0; | 25 chrome.appNotifications = new function() { |
26 if (callback) { | 26 this.getChannel = function(clientId, callback) { |
27 callbackId = nextCallbackId++; | 27 var callbackId = 0; |
28 callbacks[callbackId] = callback; | 28 if (callback) { |
29 } | 29 callbackId = nextCallbackId++; |
30 GetAppNotifyChannel(clientId, callbackId); | 30 callbacks[callbackId] = callback; |
31 } | 31 } |
| 32 GetAppNotifyChannel(clientId, callbackId); |
32 }; | 33 }; |
33 }(); | 34 }(); |
34 | 35 |
35 chromeHidden.app = {}; | 36 chromeHidden.app = {}; |
36 chromeHidden.app.onGetAppNotifyChannelResponse = | 37 chromeHidden.app.onGetAppNotifyChannelResponse = |
37 function(channelId, error, callbackId) { | 38 function(channelId, error, callbackId) { |
38 if (callbackId) { | 39 if (callbackId) { |
39 callbacks[callbackId](channelId, error); | 40 callbacks[callbackId](channelId, error); |
40 delete callbacks[callbackId]; | 41 delete callbacks[callbackId]; |
41 } | 42 } |
42 }; | 43 }; |
43 })(); | 44 })(); |
OLD | NEW |