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

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

Issue 1840453002: [Extensions] More bindings hardening (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/renderer/resources/extensions/automation/automation_node.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Custom binding for the app API. 5 // Custom binding for the app API.
6 6
7 var GetAvailability = requireNative('v8_context').GetAvailability; 7 var GetAvailability = requireNative('v8_context').GetAvailability;
8 if (!GetAvailability('app').is_available) { 8 if (!GetAvailability('app').is_available) {
9 exports.binding = {}; 9 exports.$set('binding', {});
10 exports.onInstallStateResponse = function(){}; 10 exports.$set('onInstallStateResponse', function(){});
11 return; 11 return;
12 } 12 }
13 13
14 var appNatives = requireNative('app'); 14 var appNatives = requireNative('app');
15 var process = requireNative('process'); 15 var process = requireNative('process');
16 var extensionId = process.GetExtensionId(); 16 var extensionId = process.GetExtensionId();
17 var logActivity = requireNative('activityLogger'); 17 var logActivity = requireNative('activityLogger');
18 18
19 function wrapForLogging(fun) { 19 function wrapForLogging(fun) {
20 if (!extensionId) 20 if (!extensionId)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 var nextCallbackId = 1; 63 var nextCallbackId = 1;
64 64
65 app.installState = function getInstallState(callback) { 65 app.installState = function getInstallState(callback) {
66 var callbackId = nextCallbackId++; 66 var callbackId = nextCallbackId++;
67 callbacks[callbackId] = callback; 67 callbacks[callbackId] = callback;
68 appNatives.GetInstallState(callbackId); 68 appNatives.GetInstallState(callbackId);
69 }; 69 };
70 if (extensionId) 70 if (extensionId)
71 app.installState = wrapForLogging(app.installState); 71 app.installState = wrapForLogging(app.installState);
72 72
73 exports.binding = app; 73 exports.$set('binding', app);
74 exports.onInstallStateResponse = onInstallStateResponse; 74 exports.$set('onInstallStateResponse', onInstallStateResponse);
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/resources/extensions/automation/automation_node.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698