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

Side by Side Diff: content/browser/site_instance_impl_unittest.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 "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/stl_util.h" 6 #include "base/stl_util.h"
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "content/browser/browser_thread_impl.h" 8 #include "content/browser/browser_thread_impl.h"
9 #include "content/browser/browsing_instance.h" 9 #include "content/browser/browsing_instance.h"
10 #include "content/browser/child_process_security_policy_impl.h" 10 #include "content/browser/child_process_security_policy_impl.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return WebUI::kNoWebUI; 54 return WebUI::kNoWebUI;
55 } 55 }
56 virtual bool UseWebUIForURL(BrowserContext* browser_context, 56 virtual bool UseWebUIForURL(BrowserContext* browser_context,
57 const GURL& url) const OVERRIDE { 57 const GURL& url) const OVERRIDE {
58 return content::GetContentClient()->HasWebUIScheme(url); 58 return content::GetContentClient()->HasWebUIScheme(url);
59 } 59 }
60 virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, 60 virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context,
61 const GURL& url) const OVERRIDE { 61 const GURL& url) const OVERRIDE {
62 return content::GetContentClient()->HasWebUIScheme(url); 62 return content::GetContentClient()->HasWebUIScheme(url);
63 } 63 }
64 virtual bool IsURLAcceptableForWebUI(BrowserContext* browser_context, 64 virtual bool IsURLAcceptableForWebUI(
65 const GURL& url) const OVERRIDE { 65 BrowserContext* browser_context,
66 const GURL& url,
67 bool data_urls_allowed) const OVERRIDE {
66 return false; 68 return false;
67 } 69 }
68 }; 70 };
69 71
70 class SiteInstanceTestClient : public TestContentClient { 72 class SiteInstanceTestClient : public TestContentClient {
71 public: 73 public:
72 SiteInstanceTestClient() { 74 SiteInstanceTestClient() {
73 } 75 }
74 76
75 virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE { 77 virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE {
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 host.reset(instance->GetProcess()); 616 host.reset(instance->GetProcess());
615 EXPECT_TRUE(host.get() != NULL); 617 EXPECT_TRUE(host.get() != NULL);
616 EXPECT_TRUE(instance->HasProcess()); 618 EXPECT_TRUE(instance->HasProcess());
617 619
618 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com"))); 620 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com")));
619 EXPECT_FALSE(instance->HasWrongProcessForURL( 621 EXPECT_FALSE(instance->HasWrongProcessForURL(
620 GURL("javascript:alert(document.location.href);"))); 622 GURL("javascript:alert(document.location.href);")));
621 623
622 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings"))); 624 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings")));
623 } 625 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc ('k') | content/browser/web_contents/render_view_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698