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

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

Issue 8776022: Move app notification getChannel API out of experimental (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: another unit test fix Created 9 years 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
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 })();
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_permission_set_unittest.cc ('k') | chrome/test/data/extensions/app_notifications/launch.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698