| 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" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
| 17 #include "extensions/browser/api_activity_monitor.h" | 17 #include "extensions/browser/api_activity_monitor.h" |
| 18 #include "extensions/browser/extension_host.h" | 18 #include "extensions/browser/extension_host.h" |
| 19 #include "extensions/browser/extension_prefs.h" | 19 #include "extensions/browser/extension_prefs.h" |
| 20 #include "extensions/browser/extension_registry.h" | 20 #include "extensions/browser/extension_registry.h" |
| 21 #include "extensions/browser/extension_system.h" | 21 #include "extensions/browser/extension_system.h" |
| 22 #include "extensions/browser/extension_util.h" |
| 22 #include "extensions/browser/extensions_browser_client.h" | 23 #include "extensions/browser/extensions_browser_client.h" |
| 23 #include "extensions/browser/lazy_background_task_queue.h" | 24 #include "extensions/browser/lazy_background_task_queue.h" |
| 24 #include "extensions/browser/process_manager.h" | 25 #include "extensions/browser/process_manager.h" |
| 25 #include "extensions/browser/process_map.h" | 26 #include "extensions/browser/process_map.h" |
| 26 #include "extensions/common/extension.h" | 27 #include "extensions/common/extension.h" |
| 27 #include "extensions/common/extension_api.h" | 28 #include "extensions/common/extension_api.h" |
| 28 #include "extensions/common/extension_messages.h" | 29 #include "extensions/common/extension_messages.h" |
| 29 #include "extensions/common/extension_urls.h" | 30 #include "extensions/common/extension_urls.h" |
| 30 #include "extensions/common/manifest_handlers/background_info.h" | 31 #include "extensions/common/manifest_handlers/background_info.h" |
| 31 #include "extensions/common/manifest_handlers/incognito_info.h" | 32 #include "extensions/common/manifest_handlers/incognito_info.h" |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 if (!cross_incognito) | 563 if (!cross_incognito) |
| 563 return true; | 564 return true; |
| 564 return ExtensionsBrowserClient::Get()->CanExtensionCrossIncognito( | 565 return ExtensionsBrowserClient::Get()->CanExtensionCrossIncognito( |
| 565 extension, context); | 566 extension, context); |
| 566 } | 567 } |
| 567 | 568 |
| 568 bool EventRouter::MaybeLoadLazyBackgroundPageToDispatchEvent( | 569 bool EventRouter::MaybeLoadLazyBackgroundPageToDispatchEvent( |
| 569 BrowserContext* context, | 570 BrowserContext* context, |
| 570 const Extension* extension, | 571 const Extension* extension, |
| 571 const linked_ptr<Event>& event) { | 572 const linked_ptr<Event>& event) { |
| 572 if (extension->is_ephemeral() && !event->can_load_ephemeral_apps) { | 573 if (util::IsEphemeralApp(extension->id(), context) && |
| 574 !event->can_load_ephemeral_apps) { |
| 573 // Most events can only be dispatched to ephemeral apps that are already | 575 // Most events can only be dispatched to ephemeral apps that are already |
| 574 // running. | 576 // running. |
| 575 ProcessManager* pm = ExtensionSystem::Get(context)->process_manager(); | 577 ProcessManager* pm = ExtensionSystem::Get(context)->process_manager(); |
| 576 if (!pm->GetBackgroundHostForExtension(extension->id())) | 578 if (!pm->GetBackgroundHostForExtension(extension->id())) |
| 577 return false; | 579 return false; |
| 578 } | 580 } |
| 579 | 581 |
| 580 if (!CanDispatchEventToBrowserContext(context, extension, event)) | 582 if (!CanDispatchEventToBrowserContext(context, extension, event)) |
| 581 return false; | 583 return false; |
| 582 | 584 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 } | 768 } |
| 767 | 769 |
| 768 EventListenerInfo::EventListenerInfo(const std::string& event_name, | 770 EventListenerInfo::EventListenerInfo(const std::string& event_name, |
| 769 const std::string& extension_id, | 771 const std::string& extension_id, |
| 770 content::BrowserContext* browser_context) | 772 content::BrowserContext* browser_context) |
| 771 : event_name(event_name), | 773 : event_name(event_name), |
| 772 extension_id(extension_id), | 774 extension_id(extension_id), |
| 773 browser_context(browser_context) {} | 775 browser_context(browser_context) {} |
| 774 | 776 |
| 775 } // namespace extensions | 777 } // namespace extensions |
| OLD | NEW |