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

Side by Side Diff: chrome/renderer/resources/extension_process_bindings.js

Issue 164039: Add module-level permissions to extensions. (Closed)
Patch Set: final nits Created 11 years, 4 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
OLDNEW
1 // Copyright (c) 2009 The chrome Authors. All rights reserved. 1 // Copyright (c) 2009 The chrome 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 // ----------------------------------------------------------------------------- 5 // -----------------------------------------------------------------------------
6 // NOTE: If you change this file you need to touch renderer_resources.grd to 6 // NOTE: If you change this file you need to touch renderer_resources.grd to
7 // have your change take effect. 7 // have your change take effect.
8 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
9 9
10 // This script contains privileged chrome extension related javascript APIs. 10 // This script contains privileged chrome extension related javascript APIs.
11 // It is loaded by pages whose URL has the chrome-extension protocol. 11 // It is loaded by pages whose URL has the chrome-extension protocol.
12 12
13 var chrome = chrome || {}; 13 var chrome = chrome || {};
14 (function() { 14 (function() {
15 native function GetExtensionAPIDefinition(); 15 native function GetExtensionAPIDefinition();
16 native function StartRequest(); 16 native function StartRequest();
17 native function GetCurrentPageActions(); 17 native function GetCurrentPageActions(extensionId);
18 native function GetViews(); 18 native function GetViews();
19 native function GetChromeHidden(); 19 native function GetChromeHidden();
20 native function GetNextRequestId(); 20 native function GetNextRequestId();
21 native function OpenChannelToTab(); 21 native function OpenChannelToTab();
22 22
23 if (!chrome) 23 if (!chrome)
24 chrome = {}; 24 chrome = {};
25 25
26 var chromeHidden = GetChromeHidden(); 26 var chromeHidden = GetChromeHidden();
27 27
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 var eventName = apiDef.namespace + "." + eventDef.name; 179 var eventName = apiDef.namespace + "." + eventDef.name;
180 module[eventDef.name] = new chrome.Event(eventName); 180 module[eventDef.name] = new chrome.Event(eventName);
181 }); 181 });
182 } 182 }
183 }); 183 });
184 184
185 // --- Setup additional api's not currently handled in common/extensions/api 185 // --- Setup additional api's not currently handled in common/extensions/api
186 186
187 // Page action events send (pageActionId, {tabId, tabUrl}). 187 // Page action events send (pageActionId, {tabId, tabUrl}).
188 function setupPageActionEvents(extensionId) { 188 function setupPageActionEvents(extensionId) {
189 var pageActions = GetCurrentPageActions(); 189 var pageActions = GetCurrentPageActions(extensionId);
190 var eventName = ""; 190 var eventName = "";
191 for (var i = 0; i < pageActions.length; ++i) { 191 for (var i = 0; i < pageActions.length; ++i) {
192 eventName = extensionId + "/" + pageActions[i]; 192 eventName = extensionId + "/" + pageActions[i];
193 // Setup events for each extension_id/page_action_id string we find. 193 // Setup events for each extension_id/page_action_id string we find.
194 chrome.pageActions[pageActions[i]] = new chrome.Event(eventName); 194 chrome.pageActions[pageActions[i]] = new chrome.Event(eventName);
195 } 195 }
196 } 196 }
197 197
198 // Tabs connect() 198 // Tabs connect()
199 apiFunctions["tabs.connect"].handleRequest = function(tabId, opt_name) { 199 apiFunctions["tabs.connect"].handleRequest = function(tabId, opt_name) {
(...skipping 11 matching lines...) Expand all
211 chrome.self.onConnect = chrome.extension.onConnect; 211 chrome.self.onConnect = chrome.extension.onConnect;
212 212
213 setupPageActionEvents(extensionId); 213 setupPageActionEvents(extensionId);
214 }); 214 });
215 215
216 // Self getViews(); 216 // Self getViews();
217 apiFunctions["self.getViews"].handleRequest = function() { 217 apiFunctions["self.getViews"].handleRequest = function() {
218 return GetViews(); 218 return GetViews();
219 } 219 }
220 })(); 220 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698