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

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

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 | « extensions/browser/event_listener_map_unittest.cc ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_router.h" 5 #include "extensions/browser/event_router.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 GetRegisteredEvents(extension->id()); 756 GetRegisteredEvents(extension->id());
757 listeners_.LoadUnfilteredLazyListeners(extension->id(), registered_events); 757 listeners_.LoadUnfilteredLazyListeners(extension->id(), registered_events);
758 const DictionaryValue* filtered_events = GetFilteredEvents(extension->id()); 758 const DictionaryValue* filtered_events = GetFilteredEvents(extension->id());
759 if (filtered_events) 759 if (filtered_events)
760 listeners_.LoadFilteredLazyListeners(extension->id(), *filtered_events); 760 listeners_.LoadFilteredLazyListeners(extension->id(), *filtered_events);
761 } 761 }
762 762
763 void EventRouter::OnExtensionUnloaded(content::BrowserContext* browser_context, 763 void EventRouter::OnExtensionUnloaded(content::BrowserContext* browser_context,
764 const Extension* extension, 764 const Extension* extension,
765 UnloadedExtensionInfo::Reason reason) { 765 UnloadedExtensionInfo::Reason reason) {
766 // Remove all registered lazy listeners from our cache. 766 // Remove all registered listeners from our cache.
767 listeners_.RemoveLazyListenersForExtension(extension->id()); 767 listeners_.RemoveListenersForExtension(extension->id());
768 } 768 }
769 769
770 Event::Event(const std::string& event_name, 770 Event::Event(const std::string& event_name,
771 scoped_ptr<base::ListValue> event_args) 771 scoped_ptr<base::ListValue> event_args)
772 : event_name(event_name), 772 : event_name(event_name),
773 event_args(event_args.Pass()), 773 event_args(event_args.Pass()),
774 restrict_to_browser_context(NULL), 774 restrict_to_browser_context(NULL),
775 user_gesture(EventRouter::USER_GESTURE_UNKNOWN) { 775 user_gesture(EventRouter::USER_GESTURE_UNKNOWN) {
776 DCHECK(this->event_args.get()); 776 DCHECK(this->event_args.get());
777 } 777 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 const std::string& extension_id, 818 const std::string& extension_id,
819 const GURL& listener_url, 819 const GURL& listener_url,
820 content::BrowserContext* browser_context) 820 content::BrowserContext* browser_context)
821 : event_name(event_name), 821 : event_name(event_name),
822 extension_id(extension_id), 822 extension_id(extension_id),
823 listener_url(listener_url), 823 listener_url(listener_url),
824 browser_context(browser_context) { 824 browser_context(browser_context) {
825 } 825 }
826 826
827 } // namespace extensions 827 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/event_listener_map_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698