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

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

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile errors 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 || {};
6 (function() { 5 (function() {
7 native function GetChromeHidden(); 6 var webstoreNatives = requireNative('webstore');
8 native function Install(preferredStoreUrl, onSuccess, onFailure); 7 var Install = webstoreNatives.Install;
9 8
10 var chromeHidden = GetChromeHidden(); 9 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
11 var pendingInstalls = {}; 10 var pendingInstalls = {};
12 chrome.webstore = new function() { 11 chrome.webstore = new function() {
13 this.install = function( 12 this.install = function(
14 preferredStoreLinkUrl, successCallback, failureCallback) { 13 preferredStoreLinkUrl, successCallback, failureCallback) {
15 var installId = Install( 14 var installId = Install(
16 preferredStoreLinkUrl, successCallback, failureCallback); 15 preferredStoreLinkUrl, successCallback, failureCallback);
17 if (installId !== undefined) { 16 if (installId !== undefined) {
18 pendingInstalls[installId] = { 17 pendingInstalls[installId] = {
19 successCallback: successCallback, 18 successCallback: successCallback,
20 failureCallback: failureCallback 19 failureCallback: failureCallback
(...skipping 14 matching lines...) Expand all
35 if (success && pendingInstall.successCallback) { 34 if (success && pendingInstall.successCallback) {
36 pendingInstall.successCallback(); 35 pendingInstall.successCallback();
37 } else if (!success && pendingInstall.failureCallback) { 36 } else if (!success && pendingInstall.failureCallback) {
38 pendingInstall.failureCallback(error); 37 pendingInstall.failureCallback(error);
39 } 38 }
40 } finally { 39 } finally {
41 delete pendingInstall[installId]; 40 delete pendingInstall[installId];
42 } 41 }
43 } 42 }
44 })(); 43 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698