| 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" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 ProcessManager::ProcessManager(BrowserContext* context, | 222 ProcessManager::ProcessManager(BrowserContext* context, |
| 223 BrowserContext* original_context) | 223 BrowserContext* original_context) |
| 224 : site_instance_(SiteInstance::Create(context)), | 224 : site_instance_(SiteInstance::Create(context)), |
| 225 startup_background_hosts_created_(false), | 225 startup_background_hosts_created_(false), |
| 226 devtools_callback_(base::Bind( | 226 devtools_callback_(base::Bind( |
| 227 &ProcessManager::OnDevToolsStateChanged, | 227 &ProcessManager::OnDevToolsStateChanged, |
| 228 base::Unretained(this))), | 228 base::Unretained(this))), |
| 229 weak_ptr_factory_(this) { | 229 weak_ptr_factory_(this) { |
| 230 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, | 230 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, |
| 231 content::Source<BrowserContext>(original_context)); | 231 content::Source<BrowserContext>(original_context)); |
| 232 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 232 registrar_.Add(this, |
| 233 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 233 content::Source<BrowserContext>(original_context)); | 234 content::Source<BrowserContext>(original_context)); |
| 234 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 235 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 235 content::Source<BrowserContext>(original_context)); | 236 content::Source<BrowserContext>(original_context)); |
| 236 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 237 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
| 237 content::Source<BrowserContext>(context)); | 238 content::Source<BrowserContext>(context)); |
| 238 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 239 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
| 239 content::Source<BrowserContext>(context)); | 240 content::Source<BrowserContext>(context)); |
| 240 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, | 241 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, |
| 241 content::NotificationService::AllSources()); | 242 content::NotificationService::AllSources()); |
| 242 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, | 243 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 // Don't load background hosts now if the loading should be deferred. | 644 // Don't load background hosts now if the loading should be deferred. |
| 644 // Instead they will be loaded when a browser window for this profile | 645 // Instead they will be loaded when a browser window for this profile |
| 645 // (or an incognito profile from this profile) is ready. | 646 // (or an incognito profile from this profile) is ready. |
| 646 if (DeferLoadingBackgroundHosts()) | 647 if (DeferLoadingBackgroundHosts()) |
| 647 break; | 648 break; |
| 648 | 649 |
| 649 CreateBackgroundHostsForProfileStartup(); | 650 CreateBackgroundHostsForProfileStartup(); |
| 650 break; | 651 break; |
| 651 } | 652 } |
| 652 | 653 |
| 653 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 654 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
| 654 BrowserContext* context = content::Source<BrowserContext>(source).ptr(); | 655 BrowserContext* context = content::Source<BrowserContext>(source).ptr(); |
| 655 ExtensionSystem* system = ExtensionSystem::Get(context); | 656 ExtensionSystem* system = ExtensionSystem::Get(context); |
| 656 if (system->ready().is_signaled()) { | 657 if (system->ready().is_signaled()) { |
| 657 // The extension system is ready, so create the background host. | 658 // The extension system is ready, so create the background host. |
| 658 const Extension* extension = | 659 const Extension* extension = |
| 659 content::Details<const Extension>(details).ptr(); | 660 content::Details<const Extension>(details).ptr(); |
| 660 CreateBackgroundHostForExtensionLoad(this, extension); | 661 CreateBackgroundHostForExtensionLoad(this, extension); |
| 661 } | 662 } |
| 662 break; | 663 break; |
| 663 } | 664 } |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 const Extension* extension = | 928 const Extension* extension = |
| 928 registry->enabled_extensions().GetExtensionOrAppByURL(url); | 929 registry->enabled_extensions().GetExtensionOrAppByURL(url); |
| 929 if (extension && !IncognitoInfo::IsSplitMode(extension)) { | 930 if (extension && !IncognitoInfo::IsSplitMode(extension)) { |
| 930 return original_manager_->GetSiteInstanceForURL(url); | 931 return original_manager_->GetSiteInstanceForURL(url); |
| 931 } | 932 } |
| 932 } | 933 } |
| 933 return ProcessManager::GetSiteInstanceForURL(url); | 934 return ProcessManager::GetSiteInstanceForURL(url); |
| 934 } | 935 } |
| 935 | 936 |
| 936 } // namespace extensions | 937 } // namespace extensions |
| OLD | NEW |