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

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

Issue 8662010: Rename chrome.experimental.webRequest to chrome.webRequest and chrome.webRequestBlocking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added webRequest_blocking back Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This script contains privileged chrome extension related javascript APIs. 5 // This script contains privileged chrome extension related javascript APIs.
6 // It is loaded by pages whose URL has the chrome-extension protocol. 6 // It is loaded by pages whose URL has the chrome-extension protocol.
7 7
8 var chrome = chrome || {}; 8 var chrome = chrome || {};
9 (function() { 9 (function() {
10 native function GetExtensionAPIDefinition(); 10 native function GetExtensionAPIDefinition();
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // opt_filter is specified, then the callback is only called for events that 224 // opt_filter is specified, then the callback is only called for events that
225 // match the given filters. If opt_extraInfo is specified, the given optional 225 // match the given filters. If opt_extraInfo is specified, the given optional
226 // info is sent to the callback. 226 // info is sent to the callback.
227 chrome.WebRequestEvent.prototype.addListener = 227 chrome.WebRequestEvent.prototype.addListener =
228 function(cb, opt_filter, opt_extraInfo) { 228 function(cb, opt_filter, opt_extraInfo) {
229 var subEventName = GetUniqueSubEventName(this.eventName_); 229 var subEventName = GetUniqueSubEventName(this.eventName_);
230 // Note: this could fail to validate, in which case we would not add the 230 // Note: this could fail to validate, in which case we would not add the
231 // subEvent listener. 231 // subEvent listener.
232 chromeHidden.validate(Array.prototype.slice.call(arguments, 1), 232 chromeHidden.validate(Array.prototype.slice.call(arguments, 1),
233 this.extraArgSchemas_); 233 this.extraArgSchemas_);
234 chrome.experimental.webRequest.addEventListener( 234 chrome.webRequest.addEventListener(
235 cb, opt_filter, opt_extraInfo, this.eventName_, subEventName); 235 cb, opt_filter, opt_extraInfo, this.eventName_, subEventName);
236 236
237 var subEvent = new chrome.Event(subEventName, this.argSchemas_); 237 var subEvent = new chrome.Event(subEventName, this.argSchemas_);
238 var subEventCallback = cb; 238 var subEventCallback = cb;
239 if (opt_extraInfo && opt_extraInfo.indexOf("blocking") >= 0) { 239 if (opt_extraInfo && opt_extraInfo.indexOf("blocking") >= 0) {
240 var eventName = this.eventName_; 240 var eventName = this.eventName_;
241 subEventCallback = function() { 241 subEventCallback = function() {
242 var requestId = arguments[0].requestId; 242 var requestId = arguments[0].requestId;
243 try { 243 try {
244 var result = cb.apply(null, arguments); 244 var result = cb.apply(null, arguments);
245 chrome.experimental.webRequest.eventHandled( 245 chrome.webRequest.eventHandled(
246 eventName, subEventName, requestId, result); 246 eventName, subEventName, requestId, result);
247 } catch (e) { 247 } catch (e) {
248 chrome.experimental.webRequest.eventHandled( 248 chrome.webRequest.eventHandled(
249 eventName, subEventName, requestId); 249 eventName, subEventName, requestId);
250 throw e; 250 throw e;
251 } 251 }
252 }; 252 };
253 } else if (opt_extraInfo && opt_extraInfo.indexOf("asyncBlocking") >= 0) { 253 } else if (opt_extraInfo && opt_extraInfo.indexOf("asyncBlocking") >= 0) {
254 var eventName = this.eventName_; 254 var eventName = this.eventName_;
255 subEventCallback = function() { 255 subEventCallback = function() {
256 var details = arguments[0]; 256 var details = arguments[0];
257 var requestId = details.requestId; 257 var requestId = details.requestId;
258 var handledCallback = function(response) { 258 var handledCallback = function(response) {
259 chrome.experimental.webRequest.eventHandled( 259 chrome.webRequest.eventHandled(
260 eventName, subEventName, requestId, response); 260 eventName, subEventName, requestId, response);
261 }; 261 };
262 cb.apply(null, [details, handledCallback]); 262 cb.apply(null, [details, handledCallback]);
263 }; 263 };
264 } 264 }
265 this.subEvents_.push( 265 this.subEvents_.push(
266 {subEvent: subEvent, callback: cb, subEventCallback: subEventCallback}); 266 {subEvent: subEvent, callback: cb, subEventCallback: subEventCallback});
267 subEvent.addListener(subEventCallback); 267 subEvent.addListener(subEventCallback);
268 }; 268 };
269 269
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 // Setup Events 683 // Setup Events
684 if (apiDef.events) { 684 if (apiDef.events) {
685 apiDef.events.forEach(function(eventDef) { 685 apiDef.events.forEach(function(eventDef) {
686 if (eventDef.name in module || 686 if (eventDef.name in module ||
687 addUnprivilegedAccessGetter(module, eventDef.name, 687 addUnprivilegedAccessGetter(module, eventDef.name,
688 eventDef.unprivileged)) { 688 eventDef.unprivileged)) {
689 return; 689 return;
690 } 690 }
691 691
692 var eventName = apiDef.namespace + "." + eventDef.name; 692 var eventName = apiDef.namespace + "." + eventDef.name;
693 if (apiDef.namespace == "experimental.webRequest") { 693 if (apiDef.namespace == "webRequest") {
694 module[eventDef.name] = new chrome.WebRequestEvent(eventName, 694 module[eventDef.name] = new chrome.WebRequestEvent(eventName,
695 eventDef.parameters, eventDef.extraParameters); 695 eventDef.parameters, eventDef.extraParameters);
696 } else { 696 } else {
697 module[eventDef.name] = new chrome.Event(eventName, 697 module[eventDef.name] = new chrome.Event(eventName,
698 eventDef.parameters); 698 eventDef.parameters);
699 } 699 }
700 }); 700 });
701 } 701 }
702 702
703 function addProperties(m, def) { 703 function addProperties(m, def) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 {customCallback: this.customCallback}); 946 {customCallback: this.customCallback});
947 return id; 947 return id;
948 }; 948 };
949 949
950 apiFunctions["omnibox.setDefaultSuggestion"].handleRequest = 950 apiFunctions["omnibox.setDefaultSuggestion"].handleRequest =
951 function(details) { 951 function(details) {
952 var parseResult = parseOmniboxDescription(details.description); 952 var parseResult = parseOmniboxDescription(details.description);
953 sendRequest(this.name, [parseResult], this.definition.parameters); 953 sendRequest(this.name, [parseResult], this.definition.parameters);
954 }; 954 };
955 955
956 apiFunctions["experimental.webRequest.addEventListener"].handleRequest = 956 apiFunctions["webRequest.addEventListener"].handleRequest =
957 function() { 957 function() {
958 var args = Array.prototype.slice.call(arguments); 958 var args = Array.prototype.slice.call(arguments);
959 sendRequest(this.name, args, this.definition.parameters, 959 sendRequest(this.name, args, this.definition.parameters,
960 {forIOThread: true}); 960 {forIOThread: true});
961 }; 961 };
962 962
963 apiFunctions["experimental.webRequest.eventHandled"].handleRequest = 963 apiFunctions["webRequest.eventHandled"].handleRequest =
964 function() { 964 function() {
965 var args = Array.prototype.slice.call(arguments); 965 var args = Array.prototype.slice.call(arguments);
966 sendRequest(this.name, args, this.definition.parameters, 966 sendRequest(this.name, args, this.definition.parameters,
967 {forIOThread: true}); 967 {forIOThread: true});
968 }; 968 };
969 969
970 apiFunctions["experimental.webRequest.handlerBehaviorChanged"]. 970 apiFunctions["webRequest.handlerBehaviorChanged"].
971 handleRequest = function() { 971 handleRequest = function() {
972 var args = Array.prototype.slice.call(arguments); 972 var args = Array.prototype.slice.call(arguments);
973 sendRequest(this.name, args, this.definition.parameters, 973 sendRequest(this.name, args, this.definition.parameters,
974 {forIOThread: true}); 974 {forIOThread: true});
975 }; 975 };
976 976
977 apiFunctions["contextMenus.create"].customCallback = 977 apiFunctions["contextMenus.create"].customCallback =
978 function(name, request, response) { 978 function(name, request, response) {
979 if (chrome.extension.lastError) { 979 if (chrome.extension.lastError) {
980 return; 980 return;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 1083
1084 if (!chrome.tts) 1084 if (!chrome.tts)
1085 chrome.tts = {}; 1085 chrome.tts = {};
1086 1086
1087 if (!chrome.ttsEngine) 1087 if (!chrome.ttsEngine)
1088 chrome.ttsEngine = {}; 1088 chrome.ttsEngine = {};
1089 1089
1090 if (!chrome.experimental.downloads) 1090 if (!chrome.experimental.downloads)
1091 chrome.experimental.downloads = {}; 1091 chrome.experimental.downloads = {};
1092 })(); 1092 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698