Chromium Code Reviews| 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 // Custom bindings for the app API. | |
| 6 | |
| 7 var appNatives = requireNative('app'); | |
| 8 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | |
| 9 | |
| 10 chrome.app = { | |
| 11 getIsInstalled: appNatives.GetIsInstalled, | |
| 12 install: appNatives.Install, | |
| 13 getDetails: appNatives.GetDetails, | |
| 14 getDetailsForFrame: appNatives.GetDetailsForFrame | |
| 15 }; | |
|
not at google - send to devlin
2012/03/20 03:32:13
So basically the same as how it was earlier.
Just
| |
| 16 | |
| 17 // Tricky; "getIsInstalled" is actually exposed as the getter "isInstalled", | |
| 18 // but we don't have a way to express this in the schema JSON (nor is it | |
| 19 // worth it for this one special case). | |
| 20 // | |
| 21 // So, define it manually, and let the getIsInstalled function act as its | |
| 22 // documentation. | |
| 23 chrome.app.__defineGetter__('isInstalled', appNatives.GetIsInstalled); | |
| 24 | |
| 25 // Called by app_bindings.cc. | |
| 26 chromeHidden.app = { | |
| 27 onGetAppNotifyChannelResponse: function(channelId, error, callbackId) { | |
| 28 if (callbackId) { | |
| 29 callbacks[callbackId](channelId, error); | |
| 30 delete callbacks[callbackId]; | |
| 31 } | |
| 32 } | |
| 33 }; | |
| 34 | |
| 35 // appNotification stuff. | |
| 36 // | |
| 37 // TODO(kalman): move this stuff to its own custom bindings. | |
| 38 // It will be bit tricky since I'll need to look into why there are | |
| 39 // permissions defined for app notifications, yet this always sets it up? | |
| 40 var callbacks = {}; | |
| 41 var nextCallbackId = 1; | |
| 42 | |
| 43 chrome.appNotifications = { | |
| 44 getChannel: function getChannel(clientId, callback) { | |
| 45 var callbackId = 0; | |
| 46 if (callback) { | |
| 47 callbackId = nextCallbackId++; | |
| 48 callbacks[callbackId] = callback; | |
| 49 } | |
| 50 appNatives.GetAppNotifyChannel(clientId, callbackId); | |
| 51 } | |
| 52 }; | |
| OLD | NEW |