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

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

Issue 898743002: When an extension is unloaded, unregister all event listeners, not just the lazy ones. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2272
Patch Set: Created 5 years, 10 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 | extensions/browser/event_listener_map.cc » ('j') | 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 #ifndef EXTENSIONS_BROWSER_EVENT_LISTENER_MAP_H_ 5 #ifndef EXTENSIONS_BROWSER_EVENT_LISTENER_MAP_H_
6 #define EXTENSIONS_BROWSER_EVENT_LISTENER_MAP_H_ 6 #define EXTENSIONS_BROWSER_EVENT_LISTENER_MAP_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 const std::string& event_name); 147 const std::string& event_name);
148 148
149 // Returns true if this map contains an EventListener that .Equals() 149 // Returns true if this map contains an EventListener that .Equals()
150 // |listener|. 150 // |listener|.
151 bool HasListener(const EventListener* listener); 151 bool HasListener(const EventListener* listener);
152 152
153 // Returns true if there is a listener for |extension_id| in |process|. 153 // Returns true if there is a listener for |extension_id| in |process|.
154 bool HasProcessListener(content::RenderProcessHost* process, 154 bool HasProcessListener(content::RenderProcessHost* process,
155 const std::string& extension_id); 155 const std::string& extension_id);
156 156
157 // Removes any lazy listeners that |extension_id| has added. 157 // Removes any listeners that |extension_id| has added, both lazy and regular.
158 void RemoveLazyListenersForExtension(const std::string& extension_id); 158 void RemoveListenersForExtension(const std::string& extension_id);
159 159
160 // Adds unfiltered lazy listeners as described their serialised descriptions. 160 // Adds unfiltered lazy listeners as described their serialised descriptions.
161 // |event_names| the names of the lazy events. 161 // |event_names| the names of the lazy events.
162 // Note that we can only load lazy listeners in this fashion, because there 162 // Note that we can only load lazy listeners in this fashion, because there
163 // is no way to serialise a RenderProcessHost*. 163 // is no way to serialise a RenderProcessHost*.
164 void LoadUnfilteredLazyListeners(const std::string& extension_id, 164 void LoadUnfilteredLazyListeners(const std::string& extension_id,
165 const std::set<std::string>& event_names); 165 const std::set<std::string>& event_names);
166 166
167 // Adds filtered lazy listeners as described their serialised descriptions. 167 // Adds filtered lazy listeners as described their serialised descriptions.
168 // |filtered| contains a map from event names to filters, each pairing 168 // |filtered| contains a map from event names to filters, each pairing
(...skipping 20 matching lines...) Expand all
189 std::map<EventFilter::MatcherID, EventListener*> listeners_by_matcher_id_; 189 std::map<EventFilter::MatcherID, EventListener*> listeners_by_matcher_id_;
190 190
191 EventFilter event_filter_; 191 EventFilter event_filter_;
192 192
193 DISALLOW_COPY_AND_ASSIGN(EventListenerMap); 193 DISALLOW_COPY_AND_ASSIGN(EventListenerMap);
194 }; 194 };
195 195
196 } // namespace extensions 196 } // namespace extensions
197 197
198 #endif // EXTENSIONS_BROWSER_EVENT_LISTENER_MAP_H_ 198 #endif // EXTENSIONS_BROWSER_EVENT_LISTENER_MAP_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/event_listener_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698