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

Unified Diff: extensions/renderer/event_bindings.cc

Issue 794803002: Refactor: cleanup declarative_api.cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/event_bindings.cc
diff --git a/extensions/renderer/event_bindings.cc b/extensions/renderer/event_bindings.cc
index bad6a02542c6d7c49943f0c6e0718015ae5f0a2f..2852c044743d70d2836c5e6b2da06547822e71f2 100644
--- a/extensions/renderer/event_bindings.cc
+++ b/extensions/renderer/event_bindings.cc
@@ -165,12 +165,15 @@ EventBindings::~EventBindings() {}
// Attach an event name to an object.
void EventBindings::AttachEvent(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- CHECK_EQ(1, args.Length());
+ CHECK_EQ(2, args.Length());
CHECK(args[0]->IsString());
+ CHECK(args[1]->IsInt32());
std::string event_name = *v8::String::Utf8Value(args[0]);
+ int guest_view_instance_id = args[1]->Int32Value();
- if (!dispatcher_->CheckContextAccessToExtensionAPI(event_name, context()))
+ if (!guest_view_instance_id &&
not at google - send to devlin 2014/12/11 22:10:48 If it's an int, prefer to use guest_view_instance_
Xi Han 2014/12/12 22:28:30 Done.
+ !dispatcher_->CheckContextAccessToExtensionAPI(event_name, context()))
not at google - send to devlin 2014/12/11 22:10:48 It's nice to surround this in {} when the conditio
Xi Han 2014/12/12 22:28:30 Done.
return;
not at google - send to devlin 2014/12/11 22:10:48 All the above said, it's pretty weird to see secur
Xi Han 2014/12/12 22:28:30 As discussed offline, the problem here is: if pass
const std::string& extension_id = context()->GetExtensionID();

Powered by Google App Engine
This is Rietveld 408576698