| 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 #include "extensions/browser/process_manager.h" | 5 #include "extensions/browser/process_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/extensions/api/runtime/runtime_api.h" |
| 17 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
| 18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/devtools_agent_host.h" | 20 #include "content/public/browser/devtools_agent_host.h" |
| 20 #include "content/public/browser/devtools_manager.h" | 21 #include "content/public/browser/devtools_manager.h" |
| 21 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
| 22 #include "content/public/browser/render_frame_host.h" | 23 #include "content/public/browser/render_frame_host.h" |
| 23 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
| 24 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
| 25 #include "content/public/browser/site_instance.h" | 26 #include "content/public/browser/site_instance.h" |
| 26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/browser/web_contents_delegate.h" | 28 #include "content/public/browser/web_contents_delegate.h" |
| 28 #include "content/public/browser/web_contents_observer.h" | 29 #include "content/public/browser/web_contents_observer.h" |
| 29 #include "content/public/browser/web_contents_user_data.h" | 30 #include "content/public/browser/web_contents_user_data.h" |
| 30 #include "content/public/common/renderer_preferences.h" | 31 #include "content/public/common/renderer_preferences.h" |
| 31 #include "extensions/browser/api/runtime/runtime_event_router.h" | |
| 32 #include "extensions/browser/extension_host.h" | 32 #include "extensions/browser/extension_host.h" |
| 33 #include "extensions/browser/extension_registry.h" | 33 #include "extensions/browser/extension_registry.h" |
| 34 #include "extensions/browser/extension_system.h" | 34 #include "extensions/browser/extension_system.h" |
| 35 #include "extensions/browser/extensions_browser_client.h" | 35 #include "extensions/browser/extensions_browser_client.h" |
| 36 #include "extensions/browser/view_type_utils.h" | 36 #include "extensions/browser/view_type_utils.h" |
| 37 #include "extensions/common/extension.h" | 37 #include "extensions/common/extension.h" |
| 38 #include "extensions/common/extension_messages.h" | 38 #include "extensions/common/extension_messages.h" |
| 39 #include "extensions/common/manifest_handlers/background_info.h" | 39 #include "extensions/common/manifest_handlers/background_info.h" |
| 40 #include "extensions/common/manifest_handlers/incognito_info.h" | 40 #include "extensions/common/manifest_handlers/incognito_info.h" |
| 41 #include "extensions/common/one_shot_event.h" | 41 #include "extensions/common/one_shot_event.h" |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 return; | 764 return; |
| 765 } | 765 } |
| 766 | 766 |
| 767 const ExtensionSet& enabled_extensions = | 767 const ExtensionSet& enabled_extensions = |
| 768 ExtensionRegistry::Get(GetBrowserContext())->enabled_extensions(); | 768 ExtensionRegistry::Get(GetBrowserContext())->enabled_extensions(); |
| 769 for (ExtensionSet::const_iterator extension = enabled_extensions.begin(); | 769 for (ExtensionSet::const_iterator extension = enabled_extensions.begin(); |
| 770 extension != enabled_extensions.end(); | 770 extension != enabled_extensions.end(); |
| 771 ++extension) { | 771 ++extension) { |
| 772 CreateBackgroundHostForExtensionLoad(this, extension->get()); | 772 CreateBackgroundHostForExtensionLoad(this, extension->get()); |
| 773 | 773 |
| 774 #if defined(ENABLE_EXTENSIONS) | |
| 775 // Android cannot call API implementations. | |
| 776 RuntimeEventRouter::DispatchOnStartupEvent(GetBrowserContext(), | 774 RuntimeEventRouter::DispatchOnStartupEvent(GetBrowserContext(), |
| 777 (*extension)->id()); | 775 (*extension)->id()); |
| 778 #endif | |
| 779 } | 776 } |
| 780 startup_background_hosts_created_ = true; | 777 startup_background_hosts_created_ = true; |
| 781 | 778 |
| 782 // Background pages should only be loaded once. To prevent any further loads | 779 // Background pages should only be loaded once. To prevent any further loads |
| 783 // occurring, we remove the notification listeners. | 780 // occurring, we remove the notification listeners. |
| 784 BrowserContext* original_context = | 781 BrowserContext* original_context = |
| 785 ExtensionsBrowserClient::Get()->GetOriginalContext(GetBrowserContext()); | 782 ExtensionsBrowserClient::Get()->GetOriginalContext(GetBrowserContext()); |
| 786 if (registrar_.IsRegistered( | 783 if (registrar_.IsRegistered( |
| 787 this, | 784 this, |
| 788 chrome::NOTIFICATION_PROFILE_CREATED, | 785 chrome::NOTIFICATION_PROFILE_CREATED, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 const Extension* extension = | 909 const Extension* extension = |
| 913 registry->enabled_extensions().GetExtensionOrAppByURL(url); | 910 registry->enabled_extensions().GetExtensionOrAppByURL(url); |
| 914 if (extension && !IncognitoInfo::IsSplitMode(extension)) { | 911 if (extension && !IncognitoInfo::IsSplitMode(extension)) { |
| 915 return original_manager_->GetSiteInstanceForURL(url); | 912 return original_manager_->GetSiteInstanceForURL(url); |
| 916 } | 913 } |
| 917 } | 914 } |
| 918 return ProcessManager::GetSiteInstanceForURL(url); | 915 return ProcessManager::GetSiteInstanceForURL(url); |
| 919 } | 916 } |
| 920 | 917 |
| 921 } // namespace extensions | 918 } // namespace extensions |
| OLD | NEW |