| OLD | NEW |
| 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 // Custom bindings for the webstore API. | 5 // Custom binding for the webstore API. |
| 6 | 6 |
| 7 var webstoreNatives = requireNative('webstore'); | 7 var webstoreNatives = requireNative('webstore'); |
| 8 | 8 |
| 9 function Installer() { | 9 function Installer() { |
| 10 this._pendingInstalls = {}; | 10 this._pendingInstalls = {}; |
| 11 } | 11 } |
| 12 | 12 |
| 13 Installer.prototype.install = function(url, onSuccess, onFailure) { | 13 Installer.prototype.install = function(url, onSuccess, onFailure) { |
| 14 var installId = webstoreNatives.Install(url, onSuccess, onFailure); | 14 var installId = webstoreNatives.Install(url, onSuccess, onFailure); |
| 15 if (installId !== undefined) { | 15 if (installId !== undefined) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 var installer = new Installer(); | 42 var installer = new Installer(); |
| 43 | 43 |
| 44 var chromeWebstore = { | 44 var chromeWebstore = { |
| 45 install: function install(url, onSuccess, onFailure) { | 45 install: function install(url, onSuccess, onFailure) { |
| 46 installer.install(url, onSuccess, onFailure); | 46 installer.install(url, onSuccess, onFailure); |
| 47 } | 47 } |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // Called by webstore_bindings.cc. | 50 // Called by webstore_binding.cc. |
| 51 var chromeHiddenWebstore = { | 51 var chromeHiddenWebstore = { |
| 52 onInstallResponse: function(installId, success, error) { | 52 onInstallResponse: function(installId, success, error) { |
| 53 installer.onInstallResponse(installId, success, error); | 53 installer.onInstallResponse(installId, success, error); |
| 54 } | 54 } |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // These must match the names in InstallWebstoreBindings in | 57 // These must match the names in InstallWebstorebinding in |
| 58 // chrome/renderer/extensions/dispatcher.cc. | 58 // chrome/renderer/extensions/dispatcher.cc. |
| 59 exports.chromeWebstore = chromeWebstore; | 59 exports.chromeWebstore = chromeWebstore; |
| 60 exports.chromeHiddenWebstore = chromeHiddenWebstore; | 60 exports.chromeHiddenWebstore = chromeHiddenWebstore; |
| OLD | NEW |