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