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

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

Issue 28273006: <webview>: Implement declarativeWebRequest API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits Created 7 years, 1 month 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/event.js
diff --git a/chrome/renderer/resources/extensions/event.js b/chrome/renderer/resources/extensions/event.js
index c6c5a0fc0151355d542192d2237caf3f213a3859..5625f1464112bac0cf564ec3472937275cdd90a3 100644
--- a/chrome/renderer/resources/extensions/event.js
+++ b/chrome/renderer/resources/extensions/event.js
@@ -187,11 +187,16 @@
//
// If opt_eventOptions exists, it is a dictionary that contains the boolean
// entries "supportsListeners" and "supportsRules".
- var Event = function(opt_eventName, opt_argSchemas, opt_eventOptions) {
+ // If opt_webViewInstanceId exists, it is an integer uniquely identifying a
+ // <webview> tag within the embedder. If it does not exist, then this is an
+ // extension event rather than a <webview> event.
+ var Event = function(opt_eventName, opt_argSchemas, opt_eventOptions,
+ opt_webViewInstanceId) {
this.eventName_ = opt_eventName;
this.argSchemas_ = opt_argSchemas;
this.listeners_ = [];
this.eventOptions_ = parseEventOptions(opt_eventOptions);
+ this.webViewInstanceId_ = opt_webViewInstanceId || 0;
if (!this.eventName_) {
if (this.eventOptions_.supportsRules)
@@ -447,10 +452,11 @@
ensureRuleSchemasLoaded();
// We remove the first parameter from the validation to give the user more
// meaningful error messages.
- validate([rules, opt_cb],
+ validate([this.webViewInstanceId_, rules, opt_cb],
$Array.splice(
$Array.slice(ruleFunctionSchemas.addRules.parameters), 1));
- sendRequest("events.addRules", [this.eventName_, rules, opt_cb],
+ sendRequest("events.addRules",
+ [this.eventName_, this.webViewInstanceId_, rules, opt_cb],
ruleFunctionSchemas.addRules.parameters);
}
@@ -460,11 +466,14 @@
ensureRuleSchemasLoaded();
// We remove the first parameter from the validation to give the user more
// meaningful error messages.
- validate([ruleIdentifiers, opt_cb],
+ validate([this.webViewInstanceId_, ruleIdentifiers, opt_cb],
$Array.splice(
$Array.slice(ruleFunctionSchemas.removeRules.parameters), 1));
sendRequest("events.removeRules",
- [this.eventName_, ruleIdentifiers, opt_cb],
+ [this.eventName_,
+ this.webViewInstanceId_,
+ ruleIdentifiers,
+ opt_cb],
ruleFunctionSchemas.removeRules.parameters);
}
@@ -474,12 +483,12 @@
ensureRuleSchemasLoaded();
// We remove the first parameter from the validation to give the user more
// meaningful error messages.
- validate([ruleIdentifiers, cb],
+ validate([this.webViewInstanceId_, ruleIdentifiers, cb],
$Array.splice(
$Array.slice(ruleFunctionSchemas.getRules.parameters), 1));
sendRequest("events.getRules",
- [this.eventName_, ruleIdentifiers, cb],
+ [this.eventName_, this.webViewInstanceId_, ruleIdentifiers, cb],
ruleFunctionSchemas.getRules.parameters);
}
« no previous file with comments | « chrome/renderer/extensions/dispatcher.cc ('k') | chrome/renderer/resources/extensions/web_request_internal_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698