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

Unified Diff: extensions/browser/event_listener_map.cc

Issue 411733002: WIP: diff which plumbs through the event URL. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
« no previous file with comments | « extensions/browser/event_listener_map.h ('k') | extensions/browser/event_listener_map_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/event_listener_map.cc
diff --git a/extensions/browser/event_listener_map.cc b/extensions/browser/event_listener_map.cc
index 5d90e980ebe732000daaac695e44201f4997e2b2..076b128bc57940b092b0ec4bc9ad616176e7ea9c 100644
--- a/extensions/browser/event_listener_map.cc
+++ b/extensions/browser/event_listener_map.cc
@@ -8,6 +8,7 @@
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/event_router.h"
#include "ipc/ipc_message.h"
+#include "url/gurl.h"
using base::DictionaryValue;
@@ -17,10 +18,12 @@ typedef EventFilter::MatcherID MatcherID;
EventListener::EventListener(const std::string& event_name,
const std::string& extension_id,
+ const GURL& listener_url,
content::RenderProcessHost* process,
scoped_ptr<DictionaryValue> filter)
: event_name_(event_name),
extension_id_(extension_id),
+ listener_url_(listener_url),
process_(process),
filter_(filter.Pass()),
matcher_id_(-1) {
@@ -33,7 +36,8 @@ bool EventListener::Equals(const EventListener* other) const {
// filter that hasn't been added to EventFilter to match one that is
// equivalent but has.
return event_name_ == other->event_name_ &&
- extension_id_ == other->extension_id_ && process_ == other->process_ &&
+ extension_id_ == other->extension_id_ &&
+ listener_url_ == other->listener_url_ && process_ == other->process_ &&
((!!filter_.get()) == (!!other->filter_.get())) &&
(!filter_.get() || filter_->Equals(other->filter_.get()));
}
@@ -43,7 +47,7 @@ scoped_ptr<EventListener> EventListener::Copy() const {
if (filter_)
filter_copy.reset(filter_->DeepCopy());
return scoped_ptr<EventListener>(new EventListener(
- event_name_, extension_id_, process_, filter_copy.Pass()));
+ event_name_, extension_id_, listener_url_, process_, filter_copy.Pass()));
}
bool EventListener::IsLazy() const {
@@ -144,6 +148,7 @@ bool EventListenerMap::HasProcessListener(content::RenderProcessHost* process,
it++) {
for (ListenerList::iterator it2 = it->second.begin();
it2 != it->second.end(); it2++) {
+ // TODO(kalman): Thread listener_url into here?
if ((*it2)->process() == process &&
(*it2)->extension_id() == extension_id)
return true;
@@ -174,7 +179,7 @@ void EventListenerMap::LoadUnfilteredLazyListeners(
for (std::set<std::string>::const_iterator it = event_names.begin();
it != event_names.end(); ++it) {
AddListener(scoped_ptr<EventListener>(new EventListener(
- *it, extension_id, NULL, scoped_ptr<DictionaryValue>())));
+ *it, extension_id, GURL(), NULL, scoped_ptr<DictionaryValue>())));
}
}
@@ -190,9 +195,12 @@ void EventListenerMap::LoadFilteredLazyListeners(
const DictionaryValue* filter = NULL;
if (!filter_list->GetDictionary(i, &filter))
continue;
- AddListener(scoped_ptr<EventListener>(new EventListener(
- it.key(), extension_id, NULL,
- scoped_ptr<DictionaryValue>(filter->DeepCopy()))));
+ AddListener(scoped_ptr<EventListener>(
+ new EventListener(it.key(),
+ extension_id,
+ GURL(),
+ NULL,
+ scoped_ptr<DictionaryValue>(filter->DeepCopy()))));
}
}
}
« no previous file with comments | « extensions/browser/event_listener_map.h ('k') | extensions/browser/event_listener_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698