OLD | NEW |
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 "content/browser/debugger/devtools_manager_impl.h" | 9 #include "content/browser/debugger/devtools_manager_impl.h" |
10 #include "content/browser/renderer_host/render_view_host.h" | 10 #include "content/browser/renderer_host/render_view_host.h" |
11 #include "content/browser/renderer_host/render_view_host_delegate.h" | 11 #include "content/browser/renderer_host/render_view_host_delegate.h" |
12 #include "content/browser/renderer_host/render_view_host_factory.h" | 12 #include "content/browser/renderer_host/render_view_host_factory.h" |
13 #include "content/browser/renderer_host/render_widget_host_view.h" | 13 #include "content/browser/renderer_host/render_widget_host_view.h" |
14 #include "content/browser/site_instance.h" | 14 #include "content/browser/site_instance.h" |
15 #include "content/browser/tab_contents/navigation_controller_impl.h" | 15 #include "content/browser/tab_contents/navigation_controller_impl.h" |
16 #include "content/browser/tab_contents/navigation_entry_impl.h" | 16 #include "content/browser/tab_contents/navigation_entry_impl.h" |
17 #include "content/browser/tab_contents/tab_contents_view.h" | 17 #include "content/browser/tab_contents/tab_contents_view.h" |
18 #include "content/browser/webui/web_ui.h" | 18 #include "content/browser/webui/web_ui.h" |
19 #include "content/browser/webui/web_ui_factory.h" | |
20 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
21 #include "content/common/view_messages.h" | 20 #include "content/common/view_messages.h" |
22 #include "content/public/browser/content_browser_client.h" | 21 #include "content/public/browser/content_browser_client.h" |
23 #include "content/public/browser/notification_types.h" | 22 #include "content/public/browser/notification_types.h" |
| 23 #include "content/public/browser/web_ui_factory.h" |
24 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
25 #include "content/public/common/url_constants.h" | 25 #include "content/public/common/url_constants.h" |
26 | 26 |
27 using content::NavigationController; | 27 using content::NavigationController; |
28 using content::NavigationEntry; | 28 using content::NavigationEntry; |
29 using content::NavigationEntryImpl; | 29 using content::NavigationEntryImpl; |
30 | 30 |
31 RenderViewHostManager::RenderViewHostManager( | 31 RenderViewHostManager::RenderViewHostManager( |
32 RenderViewHostDelegate* render_view_delegate, | 32 RenderViewHostDelegate* render_view_delegate, |
33 Delegate* delegate) | 33 Delegate* delegate) |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // Check for reasons to swap processes even if we are in a process model that | 337 // Check for reasons to swap processes even if we are in a process model that |
338 // doesn't usually swap (e.g., process-per-tab). | 338 // doesn't usually swap (e.g., process-per-tab). |
339 | 339 |
340 // For security, we should transition between processes when one is a Web UI | 340 // For security, we should transition between processes when one is a Web UI |
341 // page and one isn't. If there's no cur_entry, check the current RVH's | 341 // page and one isn't. If there's no cur_entry, check the current RVH's |
342 // site, which might already be committed to a Web UI URL (such as the NTP). | 342 // site, which might already be committed to a Web UI URL (such as the NTP). |
343 const GURL& current_url = (cur_entry) ? cur_entry->GetURL() : | 343 const GURL& current_url = (cur_entry) ? cur_entry->GetURL() : |
344 render_view_host_->site_instance()->site(); | 344 render_view_host_->site_instance()->site(); |
345 content::BrowserContext* browser_context = | 345 content::BrowserContext* browser_context = |
346 delegate_->GetControllerForRenderManager().GetBrowserContext(); | 346 delegate_->GetControllerForRenderManager().GetBrowserContext(); |
347 const content::WebUIFactory* web_ui_factory = content::WebUIFactory::Get(); | 347 const content::WebUIFactory* web_ui_factory = |
| 348 content::GetContentClient()->browser()->GetWebUIFactory(); |
348 if (web_ui_factory->UseWebUIForURL(browser_context, current_url)) { | 349 if (web_ui_factory->UseWebUIForURL(browser_context, current_url)) { |
349 // Force swap if it's not an acceptable URL for Web UI. | 350 // Force swap if it's not an acceptable URL for Web UI. |
350 if (!web_ui_factory->IsURLAcceptableForWebUI(browser_context, | 351 if (!web_ui_factory->IsURLAcceptableForWebUI(browser_context, |
351 new_entry->GetURL())) | 352 new_entry->GetURL())) |
352 return true; | 353 return true; |
353 } else { | 354 } else { |
354 // Force swap if it's a Web UI URL. | 355 // Force swap if it's a Web UI URL. |
355 if (web_ui_factory->UseWebUIForURL(browser_context, new_entry->GetURL())) | 356 if (web_ui_factory->UseWebUIForURL(browser_context, new_entry->GetURL())) |
356 return true; | 357 return true; |
357 } | 358 } |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 } | 808 } |
808 } | 809 } |
809 | 810 |
810 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { | 811 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { |
811 if (!rvh->site_instance()) | 812 if (!rvh->site_instance()) |
812 return false; | 813 return false; |
813 | 814 |
814 return swapped_out_hosts_.find(rvh->site_instance()->id()) != | 815 return swapped_out_hosts_.find(rvh->site_instance()->id()) != |
815 swapped_out_hosts_.end(); | 816 swapped_out_hosts_.end(); |
816 } | 817 } |
OLD | NEW |