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

Side by Side Diff: content/browser/tab_contents/render_view_host_manager.cc

Issue 6708114: Revert 79691 - Move WebUIFactory to chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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 | « content/browser/site_instance.cc ('k') | content/browser/tab_contents/tab_contents.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tab_contents/render_view_host_manager.h" 5 #include "content/browser/tab_contents/render_view_host_manager.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 "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/common/render_messages.h" 11 #include "chrome/common/render_messages.h"
12 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
13 #include "content/browser/content_browser_client.h" 13 #include "content/browser/content_browser_client.h"
14 #include "content/browser/renderer_host/render_view_host.h" 14 #include "content/browser/renderer_host/render_view_host.h"
15 #include "content/browser/renderer_host/render_view_host_delegate.h" 15 #include "content/browser/renderer_host/render_view_host_delegate.h"
16 #include "content/browser/renderer_host/render_view_host_factory.h" 16 #include "content/browser/renderer_host/render_view_host_factory.h"
17 #include "content/browser/renderer_host/render_widget_host_view.h" 17 #include "content/browser/renderer_host/render_widget_host_view.h"
18 #include "content/browser/site_instance.h" 18 #include "content/browser/site_instance.h"
19 #include "content/browser/tab_contents/navigation_controller.h" 19 #include "content/browser/tab_contents/navigation_controller.h"
20 #include "content/browser/tab_contents/navigation_entry.h" 20 #include "content/browser/tab_contents/navigation_entry.h"
21 #include "content/browser/tab_contents/tab_contents_view.h" 21 #include "content/browser/tab_contents/tab_contents_view.h"
22 #include "content/browser/webui/web_ui.h" 22 #include "content/browser/webui/web_ui.h"
23 #include "content/browser/webui/web_ui_factory.h" 23 #include "content/browser/webui/web_ui_factory.h"
24 #include "content/common/content_client.h"
25 #include "content/common/notification_service.h" 24 #include "content/common/notification_service.h"
26 #include "content/common/notification_type.h" 25 #include "content/common/notification_type.h"
27 #include "content/common/view_messages.h" 26 #include "content/common/view_messages.h"
28 27
29 namespace base { 28 namespace base {
30 class WaitableEvent; 29 class WaitableEvent;
31 } 30 }
32 31
33 RenderViewHostManager::RenderViewHostManager( 32 RenderViewHostManager::RenderViewHostManager(
34 RenderViewHostDelegate* render_view_delegate, 33 RenderViewHostDelegate* render_view_delegate,
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 294
296 // Check for reasons to swap processes even if we are in a process model that 295 // Check for reasons to swap processes even if we are in a process model that
297 // doesn't usually swap (e.g., process-per-tab). 296 // doesn't usually swap (e.g., process-per-tab).
298 297
299 // For security, we should transition between processes when one is a Web UI 298 // For security, we should transition between processes when one is a Web UI
300 // page and one isn't. If there's no cur_entry, check the current RVH's 299 // page and one isn't. If there's no cur_entry, check the current RVH's
301 // site, which might already be committed to a Web UI URL (such as the NTP). 300 // site, which might already be committed to a Web UI URL (such as the NTP).
302 const GURL& current_url = (cur_entry) ? cur_entry->url() : 301 const GURL& current_url = (cur_entry) ? cur_entry->url() :
303 render_view_host_->site_instance()->site(); 302 render_view_host_->site_instance()->site();
304 Profile* profile = delegate_->GetControllerForRenderManager().profile(); 303 Profile* profile = delegate_->GetControllerForRenderManager().profile();
305 const content::WebUIFactory* web_ui_factory = content::WebUIFactory::Get(); 304 if (WebUIFactory::UseWebUIForURL(profile, current_url)) {
306 if (web_ui_factory->UseWebUIForURL(profile, current_url)) {
307 // Force swap if it's not an acceptable URL for Web UI. 305 // Force swap if it's not an acceptable URL for Web UI.
308 if (!web_ui_factory->IsURLAcceptableForWebUI(profile, new_entry->url())) 306 if (!WebUIFactory::IsURLAcceptableForWebUI(profile, new_entry->url()))
309 return true; 307 return true;
310 } else { 308 } else {
311 // Force swap if it's a Web UI URL. 309 // Force swap if it's a Web UI URL.
312 if (web_ui_factory->UseWebUIForURL(profile, new_entry->url())) 310 if (WebUIFactory::UseWebUIForURL(profile, new_entry->url()))
313 return true; 311 return true;
314 } 312 }
315 313
316 if (!cur_entry) { 314 if (!cur_entry) {
317 // Always choose a new process when navigating to extension URLs. The 315 // Always choose a new process when navigating to extension URLs. The
318 // process grouping logic will combine all of a given extension's pages 316 // process grouping logic will combine all of a given extension's pages
319 // into the same process. 317 // into the same process.
320 if (new_entry->url().SchemeIs(chrome::kExtensionScheme)) 318 if (new_entry->url().SchemeIs(chrome::kExtensionScheme))
321 return true; 319 return true;
322 320
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // to compare against the current URL and not the SiteInstance's site. In 377 // to compare against the current URL and not the SiteInstance's site. In
380 // this case, there is no current URL, so comparing against the site is ok. 378 // this case, there is no current URL, so comparing against the site is ok.
381 // See additional comments below.) 379 // See additional comments below.)
382 if (curr_instance->HasRelatedSiteInstance(dest_url)) 380 if (curr_instance->HasRelatedSiteInstance(dest_url))
383 return curr_instance->GetRelatedSiteInstance(dest_url); 381 return curr_instance->GetRelatedSiteInstance(dest_url);
384 382
385 // For extensions and Web UI URLs (such as the new tab page), we do not 383 // For extensions and Web UI URLs (such as the new tab page), we do not
386 // want to use the curr_instance if it has no site, since it will have a 384 // want to use the curr_instance if it has no site, since it will have a
387 // RenderProcessHost of TYPE_NORMAL. Create a new SiteInstance for this 385 // RenderProcessHost of TYPE_NORMAL. Create a new SiteInstance for this
388 // URL instead (with the correct process type). 386 // URL instead (with the correct process type).
389 if (content::WebUIFactory::Get()->UseWebUIForURL(profile, dest_url)) { 387 if (WebUIFactory::UseWebUIForURL(profile, dest_url))
390 return SiteInstance::CreateSiteInstanceForURL(profile, dest_url); 388 return SiteInstance::CreateSiteInstanceForURL(profile, dest_url);
391 }
392 389
393 // Normally the "site" on the SiteInstance is set lazily when the load 390 // Normally the "site" on the SiteInstance is set lazily when the load
394 // actually commits. This is to support better process sharing in case 391 // actually commits. This is to support better process sharing in case
395 // the site redirects to some other site: we want to use the destination 392 // the site redirects to some other site: we want to use the destination
396 // site in the site instance. 393 // site in the site instance.
397 // 394 //
398 // In the case of session restore, as it loads all the pages immediately 395 // In the case of session restore, as it loads all the pages immediately
399 // we need to set the site first, otherwise after a restore none of the 396 // we need to set the site first, otherwise after a restore none of the
400 // pages would share renderers in process-per-site. 397 // pages would share renderers in process-per-site.
401 if (entry.restore_type() != NavigationEntry::RESTORE_NONE) 398 if (entry.restore_type() != NavigationEntry::RESTORE_NONE)
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 Source<NavigationController>(&delegate_->GetControllerForRenderManager()), 719 Source<NavigationController>(&delegate_->GetControllerForRenderManager()),
723 Details<RenderViewHostSwitchedDetails>(&details)); 720 Details<RenderViewHostSwitchedDetails>(&details));
724 721
725 // This will cause the old RenderViewHost to delete itself. 722 // This will cause the old RenderViewHost to delete itself.
726 old_render_view_host->Shutdown(); 723 old_render_view_host->Shutdown();
727 724
728 // Let the task manager know that we've swapped RenderViewHosts, since it 725 // Let the task manager know that we've swapped RenderViewHosts, since it
729 // might need to update its process groupings. 726 // might need to update its process groupings.
730 delegate_->NotifySwappedFromRenderManager(); 727 delegate_->NotifySwappedFromRenderManager();
731 } 728 }
OLDNEW
« no previous file with comments | « content/browser/site_instance.cc ('k') | content/browser/tab_contents/tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698