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

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

Issue 2943013002: Remove unused EventRouter member function definitions. (Closed)
Patch Set: rm <utility> Created 3 years, 6 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 (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 #ifndef EXTENSIONS_BROWSER_EVENT_ROUTER_H_ 5 #ifndef EXTENSIONS_BROWSER_EVENT_ROUTER_H_
6 #define EXTENSIONS_BROWSER_EVENT_ROUTER_H_ 6 #define EXTENSIONS_BROWSER_EVENT_ROUTER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <unordered_map> 10 #include <unordered_map>
11 #include <utility>
12 11
13 #include "base/callback.h" 12 #include "base/callback.h"
14 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
15 #include "base/macros.h" 14 #include "base/macros.h"
16 #include "base/memory/linked_ptr.h" 15 #include "base/memory/linked_ptr.h"
17 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
19 #include "base/scoped_observer.h" 18 #include "base/scoped_observer.h"
20 #include "base/values.h" 19 #include "base/values.h"
21 #include "components/keyed_service/core/keyed_service.h" 20 #include "components/keyed_service/core/keyed_service.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 234
236 private: 235 private:
237 friend class EventRouterFilterTest; 236 friend class EventRouterFilterTest;
238 friend class EventRouterTest; 237 friend class EventRouterTest;
239 238
240 enum class RegisteredEventType { 239 enum class RegisteredEventType {
241 kLazy, 240 kLazy,
242 kServiceWorker, 241 kServiceWorker,
243 }; 242 };
244 243
245 // An identifier for an event dispatch that is used to prevent double dispatch
246 // due to race conditions between the direct and lazy dispatch paths.
247 typedef std::tuple<const content::BrowserContext*, std::string, int>
248 EventDispatchIdentifier;
249
250 // TODO(gdk): Document this. 244 // TODO(gdk): Document this.
251 static void DispatchExtensionMessage( 245 static void DispatchExtensionMessage(
252 IPC::Sender* ipc_sender, 246 IPC::Sender* ipc_sender,
253 int worker_thread_id, 247 int worker_thread_id,
254 void* browser_context_id, 248 void* browser_context_id,
255 const std::string& extension_id, 249 const std::string& extension_id,
256 int event_id, 250 int event_id,
257 const std::string& event_name, 251 const std::string& event_name,
258 base::ListValue* event_args, 252 base::ListValue* event_args,
259 UserGestureState user_gesture, 253 UserGestureState user_gesture,
(...skipping 20 matching lines...) Expand all
280 void RemoveLazyEventListenerImpl(const std::string& event_name, 274 void RemoveLazyEventListenerImpl(const std::string& event_name,
281 const ExtensionId& extension_id, 275 const ExtensionId& extension_id,
282 int worker_thread_id); 276 int worker_thread_id);
283 277
284 // Shared by all event dispatch methods. If |restrict_to_extension_id| is 278 // Shared by all event dispatch methods. If |restrict_to_extension_id| is
285 // empty, the event is broadcast. An event that just came off the pending 279 // empty, the event is broadcast. An event that just came off the pending
286 // list may not be delayed again. 280 // list may not be delayed again.
287 void DispatchEventImpl(const std::string& restrict_to_extension_id, 281 void DispatchEventImpl(const std::string& restrict_to_extension_id,
288 const linked_ptr<Event>& event); 282 const linked_ptr<Event>& event);
289 283
290 // Ensures that all lazy background pages that are interested in the given
291 // event are loaded, and queues the event if the page is not ready yet.
292 // Inserts an EventDispatchIdentifier into |already_dispatched| for each lazy
293 // event dispatch that is queued.
294 void DispatchLazyEvent(const std::string& extension_id,
295 const linked_ptr<Event>& event,
296 std::set<EventDispatchIdentifier>* already_dispatched,
297 const base::DictionaryValue* listener_filter);
298
299 // Dispatches the event to the specified extension or URL running in 284 // Dispatches the event to the specified extension or URL running in
300 // |process|. 285 // |process|.
301 void DispatchEventToProcess(const std::string& extension_id, 286 void DispatchEventToProcess(const std::string& extension_id,
302 const GURL& listener_url, 287 const GURL& listener_url,
303 content::RenderProcessHost* process, 288 content::RenderProcessHost* process,
304 int worker_thread_id, 289 int worker_thread_id,
305 const linked_ptr<Event>& event, 290 const linked_ptr<Event>& event,
306 const base::DictionaryValue* listener_filter, 291 const base::DictionaryValue* listener_filter,
307 bool did_enqueue); 292 bool did_enqueue);
308 293
309 // Possibly loads given extension's background page in preparation to
310 // dispatch an event. Returns true if the event was queued for subsequent
311 // dispatch, false otherwise.
312 bool MaybeLoadLazyBackgroundPageToDispatchEvent(
313 content::BrowserContext* context,
314 const Extension* extension,
315 const linked_ptr<Event>& event,
316 const base::DictionaryValue* listener_filter);
317
318 // Adds a filter to an event. 294 // Adds a filter to an event.
319 void AddFilterToEvent(const std::string& event_name, 295 void AddFilterToEvent(const std::string& event_name,
320 const std::string& extension_id, 296 const std::string& extension_id,
321 const base::DictionaryValue* filter); 297 const base::DictionaryValue* filter);
322 298
323 // Removes a filter from an event. 299 // Removes a filter from an event.
324 void RemoveFilterFromEvent(const std::string& event_name, 300 void RemoveFilterFromEvent(const std::string& event_name,
325 const std::string& extension_id, 301 const std::string& extension_id,
326 const base::DictionaryValue* filter); 302 const base::DictionaryValue* filter);
327 303
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 const std::string event_name; 442 const std::string event_name;
467 443
468 const std::string extension_id; 444 const std::string extension_id;
469 const GURL listener_url; 445 const GURL listener_url;
470 content::BrowserContext* const browser_context; 446 content::BrowserContext* const browser_context;
471 }; 447 };
472 448
473 } // namespace extensions 449 } // namespace extensions
474 450
475 #endif // EXTENSIONS_BROWSER_EVENT_ROUTER_H_ 451 #endif // EXTENSIONS_BROWSER_EVENT_ROUTER_H_
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