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