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

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: rebase 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 || {}; 5 var webstoreNatives = requireNative('webstore');
6 (function() { 6 var Install = webstoreNatives.Install;
7 native function GetChromeHidden();
8 native function Install(preferredStoreUrl, onSuccess, onFailure);
9 7
10 var chromeHidden = GetChromeHidden(); 8 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
11 var pendingInstalls = {}; 9 var pendingInstalls = {};
12 chrome.webstore = new function() { 10 chrome.webstore = new function() {
13 this.install = function( 11 this.install = function(
14 preferredStoreLinkUrl, successCallback, failureCallback) { 12 preferredStoreLinkUrl, successCallback, failureCallback) {
15 var installId = Install( 13 var installId = Install(
16 preferredStoreLinkUrl, successCallback, failureCallback); 14 preferredStoreLinkUrl, successCallback, failureCallback);
17 if (installId !== undefined) { 15 if (installId !== undefined) {
18 pendingInstalls[installId] = { 16 pendingInstalls[installId] = {
19 successCallback: successCallback, 17 successCallback: successCallback,
20 failureCallback: failureCallback 18 failureCallback: failureCallback
(...skipping 13 matching lines...) Expand all
34 try { 32 try {
35 if (success && pendingInstall.successCallback) { 33 if (success && pendingInstall.successCallback) {
36 pendingInstall.successCallback(); 34 pendingInstall.successCallback();
37 } else if (!success && pendingInstall.failureCallback) { 35 } else if (!success && pendingInstall.failureCallback) {
38 pendingInstall.failureCallback(error); 36 pendingInstall.failureCallback(error);
39 } 37 }
40 } finally { 38 } finally {
41 delete pendingInstall[installId]; 39 delete pendingInstall[installId];
42 } 40 }
43 } 41 }
44 })();
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/web_request_custom_bindings.js ('k') | chrome/renderer/resources/require.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698