| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 (function() { | |
| 6 var natives = requireNative('app'); | |
| 7 var GetIsInstalled = natives.GetIsInstalled; | |
| 8 var Install = natives.Install; | |
| 9 var GetDetails = natives.GetDetails; | |
| 10 var GetDetailsForFrame = natives.GetDetailsForFrame; | |
| 11 var GetAppNotifyChannel = natives.GetAppNotifyChannel; | |
| 12 | |
| 13 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | |
| 14 var callbacks = {}; | |
| 15 var nextCallbackId = 1; | |
| 16 | |
| 17 chrome.app = new function() { | |
| 18 this.__defineGetter__('isInstalled', GetIsInstalled); | |
| 19 this.install = Install; | |
| 20 this.getDetails = GetDetails; | |
| 21 this.getDetailsForFrame = GetDetailsForFrame; | |
| 22 }(); | |
| 23 | |
| 24 chrome.appNotifications = new function() { | |
| 25 this.getChannel = function(clientId, callback) { | |
| 26 var callbackId = 0; | |
| 27 if (callback) { | |
| 28 callbackId = nextCallbackId++; | |
| 29 callbacks[callbackId] = callback; | |
| 30 } | |
| 31 GetAppNotifyChannel(clientId, callbackId); | |
| 32 }; | |
| 33 }(); | |
| 34 | |
| 35 chromeHidden.app = {}; | |
| 36 chromeHidden.app.onGetAppNotifyChannelResponse = | |
| 37 function(channelId, error, callbackId) { | |
| 38 if (callbackId) { | |
| 39 callbacks[callbackId](channelId, error); | |
| 40 delete callbacks[callbackId]; | |
| 41 } | |
| 42 }; | |
| 43 })(); | |
| OLD | NEW |