Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: chrome/renderer/resources/extensions/app_custom_bindings.js

Issue 9460002: Convert app_bindings.js to the schema_generated_bindings.js infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make test extension ID tests pass Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 };
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 };
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/app.js ('k') | chrome/renderer/resources/extensions/schema_generated_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698