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

Side by Side Diff: extensions/browser/event_listener_map.cc

Issue 2594193002: Only use host() for chrome:// urls in EventListener (Closed)
Patch Set: Add comment Created 3 years, 12 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "extensions/browser/event_listener_map.h" 5 #include "extensions/browser/event_listener_map.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 19 matching lines...) Expand all
30 return base::WrapUnique(new EventListener(event_name, extension_id, GURL(), 30 return base::WrapUnique(new EventListener(event_name, extension_id, GURL(),
31 process, std::move(filter))); 31 process, std::move(filter)));
32 } 32 }
33 33
34 // static 34 // static
35 std::unique_ptr<EventListener> EventListener::ForURL( 35 std::unique_ptr<EventListener> EventListener::ForURL(
36 const std::string& event_name, 36 const std::string& event_name,
37 const GURL& listener_url, 37 const GURL& listener_url,
38 content::RenderProcessHost* process, 38 content::RenderProcessHost* process,
39 std::unique_ptr<base::DictionaryValue> filter) { 39 std::unique_ptr<base::DictionaryValue> filter) {
40 return base::WrapUnique(new EventListener(event_name, "", listener_url, 40 // Use only the origin to identify the event listener, e.g. chrome://settings
41 process, std::move(filter))); 41 // for chrome://settings/accounts, to avoid multiple events being triggered
42 // for the same process. See crbug.com/536858 for details.
43 return base::WrapUnique(new EventListener(
44 event_name, "", listener_url.GetOrigin(), process, std::move(filter)));
Devlin 2016/12/27 17:12:09 for annoying reasons, let's actually make this url
stevenjb 2016/12/27 17:57:37 Done.
42 } 45 }
43 46
44 EventListener::~EventListener() {} 47 EventListener::~EventListener() {}
45 48
46 bool EventListener::Equals(const EventListener* other) const { 49 bool EventListener::Equals(const EventListener* other) const {
47 // We don't check matcher_id equality because we want a listener with a 50 // We don't check matcher_id equality because we want a listener with a
48 // filter that hasn't been added to EventFilter to match one that is 51 // filter that hasn't been added to EventFilter to match one that is
49 // equivalent but has. 52 // equivalent but has.
50 return event_name_ == other->event_name_ && 53 return event_name_ == other->event_name_ &&
51 extension_id_ == other->extension_id_ && 54 extension_id_ == other->extension_id_ &&
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 return; 281 return;
279 event_filter_.RemoveEventMatcher(listener->matcher_id()); 282 event_filter_.RemoveEventMatcher(listener->matcher_id());
280 CHECK_EQ(1u, listeners_by_matcher_id_.erase(listener->matcher_id())); 283 CHECK_EQ(1u, listeners_by_matcher_id_.erase(listener->matcher_id()));
281 } 284 }
282 285
283 bool EventListenerMap::IsFilteredEvent(const Event& event) const { 286 bool EventListenerMap::IsFilteredEvent(const Event& event) const {
284 return filtered_events_.count(event.event_name) > 0u; 287 return filtered_events_.count(event.event_name) > 0u;
285 } 288 }
286 289
287 } // namespace extensions 290 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698