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

Unified Diff: chrome/renderer/resources/extensions/experimental.webrequest_custom_bindings.js

Issue 10257006: Move Declarative Web Request API out of experimental and make it a feature (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 8 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
Index: chrome/renderer/resources/extensions/experimental.webrequest_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/experimental.webrequest_custom_bindings.js b/chrome/renderer/resources/extensions/experimental.webrequest_custom_bindings.js
deleted file mode 100644
index f1177cf2aa58b6c6ff919d79aa80cfb93f729772..0000000000000000000000000000000000000000
--- a/chrome/renderer/resources/extensions/experimental.webrequest_custom_bindings.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Custom bindings for the experimental.webRequest API.
-
-var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
-
-chromeHidden.registerCustomHook('experimental.webRequest', function(api) {
- // Returns the schema definition of type |typeId| defined in |namespace|.
- function getSchema(namespace, typeId) {
- var filterNamespace = function(val) {return val.namespace === namespace;};
- var apiSchema = api.apiDefinitions.filter(filterNamespace)[0];
- var filterTypeId = function (val) {return val.id === typeId;};
- var resultSchema = apiSchema.types.filter(filterTypeId)[0];
- return resultSchema;
- }
-
- // Helper function for the constructor of concrete datatypes of the
- // declarative webRequest API.
- // Makes sure that |this| contains the union of parameters and
- // {'instanceType': 'experimental.webRequest.' + typeId} and validates the
- // generated union dictionary against the schema for |typeId|.
- function setupInstance(instance, parameters, typeId) {
- for (var key in parameters) {
- if (parameters.hasOwnProperty(key)) {
- instance[key] = parameters[key];
- }
- }
- instance.instanceType = 'experimental.webRequest.' + typeId;
- var schema = getSchema('experimental.webRequest', typeId);
- chromeHidden.validate([instance], [schema]);
- }
-
- // Setup all data types for the declarative webRequest API.
- chrome.experimental.webRequest.RequestMatcher = function(parameters) {
- setupInstance(this, parameters, 'RequestMatcher');
- };
- chrome.experimental.webRequest.CancelRequest = function(parameters) {
- setupInstance(this, parameters, 'CancelRequest');
- };
- chrome.experimental.webRequest.RedirectRequest = function(parameters) {
- setupInstance(this, parameters, 'RedirectRequest');
- };
-});

Powered by Google App Engine
This is Rietveld 408576698