Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: content/browser/browsing_instance.cc

Issue 9288074: Rename WebUIFactory to WebUIControllerFactory since that's what it creates now. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: blah Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | content/browser/mock_content_browser_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/browsing_instance.h" 5 #include "content/browser/browsing_instance.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/browser/site_instance_impl.h" 9 #include "content/browser/site_instance_impl.h"
10 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
11 #include "content/public/browser/content_browser_client.h" 11 #include "content/public/browser/content_browser_client.h"
12 #include "content/public/browser/web_ui_factory.h" 12 #include "content/public/browser/web_ui_controller_factory.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 #include "content/public/common/url_constants.h" 14 #include "content/public/common/url_constants.h"
15 15
16 using content::SiteInstance; 16 using content::SiteInstance;
17 using content::WebUIControllerFactory;
17 18
18 // static 19 // static
19 base::LazyInstance<BrowsingInstance::ContextSiteInstanceMap>::Leaky 20 base::LazyInstance<BrowsingInstance::ContextSiteInstanceMap>::Leaky
20 BrowsingInstance::context_site_instance_map_ = LAZY_INSTANCE_INITIALIZER; 21 BrowsingInstance::context_site_instance_map_ = LAZY_INSTANCE_INITIALIZER;
21 22
22 BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context) 23 BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context)
23 : browser_context_(browser_context) { 24 : browser_context_(browser_context) {
24 } 25 }
25 26
26 bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) { 27 bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) {
27 // Returns true if we should use the process-per-site model. This will be 28 // Returns true if we should use the process-per-site model. This will be
28 // the case if the --process-per-site switch is specified, or in 29 // the case if the --process-per-site switch is specified, or in
29 // process-per-site-instance for particular sites (e.g., the new tab page). 30 // process-per-site-instance for particular sites (e.g., the new tab page).
30 31
31 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 32 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
32 if (command_line.HasSwitch(switches::kProcessPerSite)) 33 if (command_line.HasSwitch(switches::kProcessPerSite))
33 return true; 34 return true;
34 35
35 // We want to consolidate particular sites like extensions and WebUI whether 36 // We want to consolidate particular sites like extensions and WebUI whether
36 // it is in process-per-tab or process-per-site-instance. 37 // it is in process-per-tab or process-per-site-instance.
37 // Note that --single-process may have been specified, but that affects the 38 // Note that --single-process may have been specified, but that affects the
38 // process creation logic in RenderProcessHost, so we do not need to worry 39 // process creation logic in RenderProcessHost, so we do not need to worry
39 // about it here. 40 // about it here.
40 41
41 if (content::GetContentClient()->browser()-> 42 if (content::GetContentClient()->browser()->
42 ShouldUseProcessPerSite(browser_context_, url)) 43 ShouldUseProcessPerSite(browser_context_, url))
43 return true; 44 return true;
44 45
45 // DevTools pages have WebUI type but should not reuse the same host. 46 // DevTools pages have WebUI type but should not reuse the same host.
46 if (content::GetContentClient()->browser()->GetWebUIFactory()-> 47 WebUIControllerFactory* factory =
47 UseWebUIForURL(browser_context_, url) && 48 content::GetContentClient()->browser()->GetWebUIControllerFactory();
49 if (factory && factory->UseWebUIForURL(browser_context_, url) &&
48 !url.SchemeIs(chrome::kChromeDevToolsScheme)) { 50 !url.SchemeIs(chrome::kChromeDevToolsScheme)) {
49 return true; 51 return true;
50 } 52 }
51 53
52 // In all other cases, don't use process-per-site logic. 54 // In all other cases, don't use process-per-site logic.
53 return false; 55 return false;
54 } 56 }
55 57
56 BrowsingInstance::SiteInstanceMap* BrowsingInstance::GetSiteInstanceMap( 58 BrowsingInstance::SiteInstanceMap* BrowsingInstance::GetSiteInstanceMap(
57 content::BrowserContext* browser_context, const GURL& url) { 59 content::BrowserContext* browser_context, const GURL& url) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return true; 153 return true;
152 } 154 }
153 return false; 155 return false;
154 } 156 }
155 157
156 BrowsingInstance::~BrowsingInstance() { 158 BrowsingInstance::~BrowsingInstance() {
157 // We should only be deleted when all of the SiteInstances that refer to 159 // We should only be deleted when all of the SiteInstances that refer to
158 // us are gone. 160 // us are gone.
159 DCHECK(site_instance_map_.empty()); 161 DCHECK(site_instance_map_.empty());
160 } 162 }
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | content/browser/mock_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698