| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // whether to fall back on the original profile's ProcessManager based | 111 // whether to fall back on the original profile's ProcessManager based |
| 112 // on whether a given extension uses "split" or "spanning" incognito behavior. | 112 // on whether a given extension uses "split" or "spanning" incognito behavior. |
| 113 class IncognitoProcessManager : public ProcessManager { | 113 class IncognitoProcessManager : public ProcessManager { |
| 114 public: | 114 public: |
| 115 IncognitoProcessManager(BrowserContext* incognito_context, | 115 IncognitoProcessManager(BrowserContext* incognito_context, |
| 116 BrowserContext* original_context, | 116 BrowserContext* original_context, |
| 117 ProcessManager* original_manager, | 117 ProcessManager* original_manager, |
| 118 ExtensionRegistry* extension_registry); | 118 ExtensionRegistry* extension_registry); |
| 119 virtual ~IncognitoProcessManager() {} | 119 virtual ~IncognitoProcessManager() {} |
| 120 virtual bool CreateBackgroundHost(const Extension* extension, | 120 virtual bool CreateBackgroundHost(const Extension* extension, |
| 121 const GURL& url) OVERRIDE; | 121 const GURL& url) override; |
| 122 virtual SiteInstance* GetSiteInstanceForURL(const GURL& url) OVERRIDE; | 122 virtual SiteInstance* GetSiteInstanceForURL(const GURL& url) override; |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 ProcessManager* original_manager_; | 125 ProcessManager* original_manager_; |
| 126 | 126 |
| 127 DISALLOW_COPY_AND_ASSIGN(IncognitoProcessManager); | 127 DISALLOW_COPY_AND_ASSIGN(IncognitoProcessManager); |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 static void CreateBackgroundHostForExtensionLoad( | 130 static void CreateBackgroundHostForExtensionLoad( |
| 131 ProcessManager* manager, const Extension* extension) { | 131 ProcessManager* manager, const Extension* extension) { |
| 132 DVLOG(1) << "CreateBackgroundHostForExtensionLoad"; | 132 DVLOG(1) << "CreateBackgroundHostForExtensionLoad"; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 146 private: | 146 private: |
| 147 explicit RenderViewHostDestructionObserver(WebContents* web_contents) | 147 explicit RenderViewHostDestructionObserver(WebContents* web_contents) |
| 148 : WebContentsObserver(web_contents) { | 148 : WebContentsObserver(web_contents) { |
| 149 BrowserContext* context = web_contents->GetBrowserContext(); | 149 BrowserContext* context = web_contents->GetBrowserContext(); |
| 150 process_manager_ = ExtensionSystem::Get(context)->process_manager(); | 150 process_manager_ = ExtensionSystem::Get(context)->process_manager(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 friend class content::WebContentsUserData<RenderViewHostDestructionObserver>; | 153 friend class content::WebContentsUserData<RenderViewHostDestructionObserver>; |
| 154 | 154 |
| 155 // content::WebContentsObserver overrides. | 155 // content::WebContentsObserver overrides. |
| 156 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE { | 156 virtual void RenderViewDeleted(RenderViewHost* render_view_host) override { |
| 157 process_manager_->UnregisterRenderViewHost(render_view_host); | 157 process_manager_->UnregisterRenderViewHost(render_view_host); |
| 158 } | 158 } |
| 159 | 159 |
| 160 ProcessManager* process_manager_; | 160 ProcessManager* process_manager_; |
| 161 | 161 |
| 162 DISALLOW_COPY_AND_ASSIGN(RenderViewHostDestructionObserver); | 162 DISALLOW_COPY_AND_ASSIGN(RenderViewHostDestructionObserver); |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 struct ProcessManager::BackgroundPageData { | 165 struct ProcessManager::BackgroundPageData { |
| 166 // The count of things keeping the lazy background page alive. | 166 // The count of things keeping the lazy background page alive. |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 SiteInstance* IncognitoProcessManager::GetSiteInstanceForURL(const GURL& url) { | 951 SiteInstance* IncognitoProcessManager::GetSiteInstanceForURL(const GURL& url) { |
| 952 const Extension* extension = | 952 const Extension* extension = |
| 953 extension_registry_->enabled_extensions().GetExtensionOrAppByURL(url); | 953 extension_registry_->enabled_extensions().GetExtensionOrAppByURL(url); |
| 954 if (extension && !IncognitoInfo::IsSplitMode(extension)) | 954 if (extension && !IncognitoInfo::IsSplitMode(extension)) |
| 955 return original_manager_->GetSiteInstanceForURL(url); | 955 return original_manager_->GetSiteInstanceForURL(url); |
| 956 | 956 |
| 957 return ProcessManager::GetSiteInstanceForURL(url); | 957 return ProcessManager::GetSiteInstanceForURL(url); |
| 958 } | 958 } |
| 959 | 959 |
| 960 } // namespace extensions | 960 } // namespace extensions |
| OLD | NEW |