| OLD | NEW |
| 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 <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 std::unique_ptr<base::DictionaryValue> filter_; | 99 std::unique_ptr<base::DictionaryValue> filter_; |
| 100 EventFilter::MatcherID matcher_id_; // -1 if unset. | 100 EventFilter::MatcherID matcher_id_; // -1 if unset. |
| 101 | 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(EventListener); | 102 DISALLOW_COPY_AND_ASSIGN(EventListener); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 // Holds listeners for extension events and can answer questions about which | 105 // Holds listeners for extension events and can answer questions about which |
| 106 // listeners are interested in what events. | 106 // listeners are interested in what events. |
| 107 class EventListenerMap { | 107 class EventListenerMap { |
| 108 public: | 108 public: |
| 109 typedef std::vector<linked_ptr<EventListener> > ListenerList; | 109 using ListenerList = std::vector<std::unique_ptr<EventListener>>; |
| 110 | 110 |
| 111 class Delegate { | 111 class Delegate { |
| 112 public: | 112 public: |
| 113 virtual ~Delegate() {} | 113 virtual ~Delegate() {} |
| 114 virtual void OnListenerAdded(const EventListener* listener) = 0; | 114 virtual void OnListenerAdded(const EventListener* listener) = 0; |
| 115 virtual void OnListenerRemoved(const EventListener* listener) = 0; | 115 virtual void OnListenerRemoved(const EventListener* listener) = 0; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 explicit EventListenerMap(Delegate* delegate); | 118 explicit EventListenerMap(Delegate* delegate); |
| 119 ~EventListenerMap(); | 119 ~EventListenerMap(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 std::map<EventFilter::MatcherID, EventListener*> listeners_by_matcher_id_; | 190 std::map<EventFilter::MatcherID, EventListener*> listeners_by_matcher_id_; |
| 191 | 191 |
| 192 EventFilter event_filter_; | 192 EventFilter event_filter_; |
| 193 | 193 |
| 194 DISALLOW_COPY_AND_ASSIGN(EventListenerMap); | 194 DISALLOW_COPY_AND_ASSIGN(EventListenerMap); |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 } // namespace extensions | 197 } // namespace extensions |
| 198 | 198 |
| 199 #endif // EXTENSIONS_BROWSER_EVENT_LISTENER_MAP_H_ | 199 #endif // EXTENSIONS_BROWSER_EVENT_LISTENER_MAP_H_ |
| OLD | NEW |