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

Unified Diff: chrome/renderer/resources/extensions/app_custom_bindings.js

Issue 2859233003: [Extensions] Improve app custom bindings (Closed)
Patch Set: . Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/app_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/app_custom_bindings.js b/chrome/renderer/resources/extensions/app_custom_bindings.js
index 4d58054b989b2a6b18d6ff555db9153abf1fe7c9..f1f4e5caa173035288732023dde67dc410092d8b 100644
--- a/chrome/renderer/resources/extensions/app_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/app_custom_bindings.js
@@ -35,13 +35,21 @@ var app = {
//
// So, define it manually, and let the getIsInstalled function act as its
// documentation.
-app.__defineGetter__('isInstalled', wrapForLogging(appNatives.GetIsInstalled));
+var isInstalled = wrapForLogging(appNatives.GetIsInstalled);
+$Object.defineProperty(
+ app, 'isInstalled',
+ {
+ __proto__: null,
+ configurable: true,
+ enumerable: true,
+ get: function() { return isInstalled(); },
+ });
// Called by app_bindings.cc.
function onInstallStateResponse(state, callbackId) {
var callback = callbacks[callbackId];
delete callbacks[callbackId];
- if (typeof(callback) == 'function') {
+ if (typeof callback == 'function') {
try {
callback(state);
} catch (e) {
@@ -52,16 +60,24 @@ function onInstallStateResponse(state, callbackId) {
}
// TODO(kalman): move this stuff to its own custom bindings.
-var callbacks = {};
+var callbacks = { __proto__: null };
var nextCallbackId = 1;
-app.installState = function getInstallState(callback) {
+function getInstallState(callback) {
var callbackId = nextCallbackId++;
callbacks[callbackId] = callback;
appNatives.GetInstallState(callbackId);
-};
-if (extensionId)
- app.installState = wrapForLogging(app.installState);
+}
+
+var installState = wrapForLogging(getInstallState);
+$Object.defineProperty(
+ app, 'installState',
+ {
+ __proto__: null,
+ configurable: true,
+ enumerable: true,
+ get: function() { return installState; },
jbroman 2017/05/08 14:25:25 This makes it an accessor property as opposed to a
Devlin 2017/05/11 14:30:38 Done.
+ });
exports.$set('binding', app);
exports.$set('onInstallStateResponse', onInstallStateResponse);
« no previous file with comments | « chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698