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._pendingInstall = null; | 10 this._pendingInstall = null; |
11 } | 11 } |
12 | 12 |
13 Installer.prototype.install = function(url, onSuccess, onFailure) { | 13 Installer.prototype.install = function(url, onSuccess, onFailure) { |
14 if (this._pendingInstall) { | 14 if (this._pendingInstall) { |
15 throw 'A Chrome Web Store installation is already pending.'; | 15 throw 'A Chrome Web Store installation is already pending.'; |
(...skipping 26 matching lines...) Expand all Loading... |
42 }; | 42 }; |
43 | 43 |
44 var installer = new Installer(); | 44 var installer = new Installer(); |
45 | 45 |
46 var chromeWebstore = { | 46 var chromeWebstore = { |
47 install: function install(url, onSuccess, onFailure) { | 47 install: function install(url, onSuccess, onFailure) { |
48 installer.install(url, onSuccess, onFailure); | 48 installer.install(url, onSuccess, onFailure); |
49 } | 49 } |
50 }; | 50 }; |
51 | 51 |
52 // Called by webstore_bindings.cc. | 52 // Called by webstore_binding.cc. |
53 var chromeHiddenWebstore = { | 53 var chromeHiddenWebstore = { |
54 onInstallResponse: function(installId, success, error) { | 54 onInstallResponse: function(installId, success, error) { |
55 installer.onInstallResponse(installId, success, error); | 55 installer.onInstallResponse(installId, success, error); |
56 } | 56 } |
57 }; | 57 }; |
58 | 58 |
59 // These must match the names in InstallWebstoreBindings in | 59 // These must match the names in InstallWebstorebinding in |
60 // chrome/renderer/extensions/dispatcher.cc. | 60 // chrome/renderer/extensions/dispatcher.cc. |
61 exports.chromeWebstore = chromeWebstore; | 61 exports.chromeWebstore = chromeWebstore; |
62 exports.chromeHiddenWebstore = chromeHiddenWebstore; | 62 exports.chromeHiddenWebstore = chromeHiddenWebstore; |
OLD | NEW |