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

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

Issue 10080018: Don't allow sending data URLs to WebUI, unless in a ChromeOS BalloonHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile errors and crash in tests. Created 8 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
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/web_contents/render_view_host_manager.h" 5 #include "content/browser/web_contents/render_view_host_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // site, which might already be committed to a Web UI URL (such as the NTP). 368 // site, which might already be committed to a Web UI URL (such as the NTP).
369 const GURL& current_url = (cur_entry) ? cur_entry->GetURL() : 369 const GURL& current_url = (cur_entry) ? cur_entry->GetURL() :
370 render_view_host_->GetSiteInstance()->GetSite(); 370 render_view_host_->GetSiteInstance()->GetSite();
371 content::BrowserContext* browser_context = 371 content::BrowserContext* browser_context =
372 delegate_->GetControllerForRenderManager().GetBrowserContext(); 372 delegate_->GetControllerForRenderManager().GetBrowserContext();
373 const WebUIControllerFactory* web_ui_factory = 373 const WebUIControllerFactory* web_ui_factory =
374 content::GetContentClient()->browser()->GetWebUIControllerFactory(); 374 content::GetContentClient()->browser()->GetWebUIControllerFactory();
375 if (web_ui_factory) { 375 if (web_ui_factory) {
376 if (web_ui_factory->UseWebUIForURL(browser_context, current_url)) { 376 if (web_ui_factory->UseWebUIForURL(browser_context, current_url)) {
377 // Force swap if it's not an acceptable URL for Web UI. 377 // Force swap if it's not an acceptable URL for Web UI.
378 // Here, data URLs are never allowed.
378 if (!web_ui_factory->IsURLAcceptableForWebUI(browser_context, 379 if (!web_ui_factory->IsURLAcceptableForWebUI(browser_context,
379 new_entry->GetURL())) 380 new_entry->GetURL(), false))
380 return true; 381 return true;
381 } else { 382 } else {
382 // Force swap if it's a Web UI URL. 383 // Force swap if it's a Web UI URL.
383 if (web_ui_factory->UseWebUIForURL(browser_context, new_entry->GetURL())) 384 if (web_ui_factory->UseWebUIForURL(browser_context, new_entry->GetURL()))
384 return true; 385 return true;
385 } 386 }
386 } 387 }
387 388
388 if (content::GetContentClient()->browser()->ShouldSwapProcessesForNavigation( 389 if (content::GetContentClient()->browser()->ShouldSwapProcessesForNavigation(
389 cur_entry ? cur_entry->GetURL() : GURL(), new_entry->GetURL())) { 390 cur_entry ? cur_entry->GetURL() : GURL(), new_entry->GetURL())) {
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 } 839 }
839 } 840 }
840 841
841 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { 842 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) {
842 if (!rvh->GetSiteInstance()) 843 if (!rvh->GetSiteInstance())
843 return false; 844 return false;
844 845
845 return swapped_out_hosts_.find(rvh->GetSiteInstance()->GetId()) != 846 return swapped_out_hosts_.find(rvh->GetSiteInstance()->GetId()) !=
846 swapped_out_hosts_.end(); 847 swapped_out_hosts_.end();
847 } 848 }
OLDNEW
« no previous file with comments | « content/browser/site_instance_impl_unittest.cc ('k') | content/browser/web_contents/render_view_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698