OLD | NEW |
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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 } | 533 } |
534 } | 534 } |
535 | 535 |
536 void EventRouter::DispatchEventToProcess(const std::string& extension_id, | 536 void EventRouter::DispatchEventToProcess(const std::string& extension_id, |
537 const GURL& listener_url, | 537 const GURL& listener_url, |
538 content::RenderProcessHost* process, | 538 content::RenderProcessHost* process, |
539 const linked_ptr<Event>& event) { | 539 const linked_ptr<Event>& event) { |
540 BrowserContext* listener_context = process->GetBrowserContext(); | 540 BrowserContext* listener_context = process->GetBrowserContext(); |
541 ProcessMap* process_map = ProcessMap::Get(listener_context); | 541 ProcessMap* process_map = ProcessMap::Get(listener_context); |
542 | 542 |
| 543 // TODO(kalman): Convert this method to use ProcessMap::GuessContextType. |
| 544 |
543 const Extension* extension = | 545 const Extension* extension = |
544 ExtensionRegistry::Get(browser_context_)->enabled_extensions().GetByID( | 546 ExtensionRegistry::Get(browser_context_)->enabled_extensions().GetByID( |
545 extension_id); | 547 extension_id); |
546 // NOTE: |extension| being NULL does not necessarily imply that this event | 548 // NOTE: |extension| being NULL does not necessarily imply that this event |
547 // shouldn't be dispatched. Events can be dispatched to WebUI as well. | 549 // shouldn't be dispatched. Events can be dispatched to WebUI as well. |
548 | 550 |
549 if (!extension && !extension_id.empty()) { | 551 if (!extension && !extension_id.empty()) { |
550 // Trying to dispatch an event to an extension that doesn't exist. The | 552 // Trying to dispatch an event to an extension that doesn't exist. The |
551 // extension could have been removed, but we do not unregister it until the | 553 // extension could have been removed, but we do not unregister it until the |
552 // extension process is unloaded. | 554 // extension process is unloaded. |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 const std::string& extension_id, | 825 const std::string& extension_id, |
824 const GURL& listener_url, | 826 const GURL& listener_url, |
825 content::BrowserContext* browser_context) | 827 content::BrowserContext* browser_context) |
826 : event_name(event_name), | 828 : event_name(event_name), |
827 extension_id(extension_id), | 829 extension_id(extension_id), |
828 listener_url(listener_url), | 830 listener_url(listener_url), |
829 browser_context(browser_context) { | 831 browser_context(browser_context) { |
830 } | 832 } |
831 | 833 |
832 } // namespace extensions | 834 } // namespace extensions |
OLD | NEW |