summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-15 21:09:56 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-15 21:09:56 +0000
commit07578ba5d0ee4653a6c22899c4991b4d20163388 (patch)
tree4bb9cf3620bbf97597dee958614449c26a818fcf /chrome
parentd906d5217d397250c6569ce93f9d1af80a407d0c (diff)
downloadchromium_src-07578ba5d0ee4653a6c22899c4991b4d20163388.zip
chromium_src-07578ba5d0ee4653a6c22899c4991b4d20163388.tar.gz
chromium_src-07578ba5d0ee4653a6c22899c4991b4d20163388.tar.bz2
revert r16181 as it broke linux
TBR=jam Review URL: http://codereview.chromium.org/115418 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.vcproj16
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc6
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc32
-rw-r--r--chrome/browser/renderer_host/renderer_security_policy.cc (renamed from chrome/browser/child_process_security_policy.cc)38
-rw-r--r--chrome/browser/renderer_host/renderer_security_policy.h (renamed from chrome/browser/child_process_security_policy.h)26
-rw-r--r--chrome/browser/renderer_host/renderer_security_policy_unittest.cc (renamed from chrome/browser/child_process_security_policy_unittest.cc)54
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc8
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc8
-rw-r--r--chrome/test/unit/unittests.vcproj8
9 files changed, 98 insertions, 98 deletions
diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj
index 327cdae..b712615 100644
--- a/chrome/browser/browser.vcproj
+++ b/chrome/browser/browser.vcproj
@@ -338,14 +338,6 @@
>
</File>
<File
- RelativePath=".\child_process_security_policy.cc"
- >
- </File>
- <File
- RelativePath=".\child_process_security_policy.h"
- >
- </File>
- <File
RelativePath=".\chrome_thread.cc"
>
</File>
@@ -2222,6 +2214,14 @@
>
</File>
<File
+ RelativePath=".\renderer_host\renderer_security_policy.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\renderer_host\renderer_security_policy.h"
+ >
+ </File>
+ <File
RelativePath=".\renderer_host\resource_dispatcher_host.cc"
>
</File>
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index e1c9bd9..6ae9d1b 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -27,7 +27,6 @@
#include "base/string_util.h"
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/extensions/user_script_master.h"
#include "chrome/browser/history/history.h"
@@ -36,6 +35,7 @@
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_helper.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
+#include "chrome/browser/renderer_host/renderer_security_policy.h"
#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/browser/renderer_host/web_cache_manager.h"
#include "chrome/browser/visitedlink_master.h"
@@ -155,7 +155,7 @@ BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile)
BrowserRenderProcessHost::~BrowserRenderProcessHost() {
if (pid() >= 0) {
WebCacheManager::GetInstance()->Remove(pid());
- ChildProcessSecurityPolicy::GetInstance()->Remove(pid());
+ RendererSecurityPolicy::GetInstance()->Remove(pid());
}
// We may have some unsent messages at this point, but that's OK.
@@ -342,7 +342,7 @@ bool BrowserRenderProcessHost::Init() {
resource_message_filter->Init(pid());
WebCacheManager::GetInstance()->Add(pid());
- ChildProcessSecurityPolicy::GetInstance()->Add(pid());
+ RendererSecurityPolicy::GetInstance()->Add(pid());
// Now that the process is created, set its backgrounding accordingly.
SetBackgrounded(backgrounded_);
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 11f8754..5fee2fb 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -14,13 +14,13 @@
#include "base/time.h"
#include "base/waitable_event.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/cross_site_request_manager.h"
#include "chrome/browser/debugger/debugger_wrapper.h"
#include "chrome/browser/debugger/devtools_manager.h"
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/profile.h"
+#include "chrome/browser/renderer_host/renderer_security_policy.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
@@ -48,7 +48,7 @@ using WebKit::WebInputEvent;
namespace {
-void FilterURL(ChildProcessSecurityPolicy* policy, int renderer_id, GURL* url) {
+void FilterURL(RendererSecurityPolicy* policy, int renderer_id, GURL* url) {
if (!url->is_valid())
return; // We don't need to block invalid URLs.
@@ -140,7 +140,7 @@ bool RenderViewHost::CreateRenderView() {
DCHECK(process()->profile());
if (enabled_bindings_ & BindingsPolicy::DOM_UI) {
- ChildProcessSecurityPolicy::GetInstance()->GrantDOMUIBindings(
+ RendererSecurityPolicy::GetInstance()->GrantDOMUIBindings(
process()->pid());
}
@@ -196,7 +196,7 @@ void RenderViewHost::NavigateToEntry(const NavigationEntry& entry,
ViewMsg_Navigate_Params params;
MakeNavigateParams(entry, is_reload, &params);
- ChildProcessSecurityPolicy::GetInstance()->GrantRequestURL(
+ RendererSecurityPolicy::GetInstance()->GrantRequestURL(
process()->pid(), params.url);
DoNavigate(entry.url(), new ViewMsg_Navigate(routing_id(), params));
@@ -209,7 +209,7 @@ void RenderViewHost::NavigateToURL(const GURL& url) {
params.transition = PageTransition::LINK;
params.reload = false;
- ChildProcessSecurityPolicy::GetInstance()->GrantRequestURL(
+ RendererSecurityPolicy::GetInstance()->GrantRequestURL(
process()->pid(), params.url);
DoNavigate(url, new ViewMsg_Navigate(routing_id(), params));
@@ -396,7 +396,7 @@ void RenderViewHost::DragTargetDragEnter(
const gfx::Point& client_pt,
const gfx::Point& screen_pt) {
// Grant the renderer the ability to load the drop_data.
- ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance();
+ RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance();
policy->GrantRequestURL(process()->pid(), drop_data.url);
for (std::vector<string16>::const_iterator iter(drop_data.filenames.begin());
iter != drop_data.filenames.end(); ++iter) {
@@ -568,7 +568,7 @@ void RenderViewHost::InspectElementAt(int x, int y) {
DevToolsManager* manager = g_browser_process->devtools_manager();
manager->InspectElement(this, x, y);
} else {
- ChildProcessSecurityPolicy::GetInstance()->
+ RendererSecurityPolicy::GetInstance()->
GrantInspectElement(process()->pid());
Send(new ViewMsg_InspectElement(routing_id(), x, y));
}
@@ -580,7 +580,7 @@ void RenderViewHost::ShowJavaScriptConsole() {
DevToolsManager* manager = g_browser_process->devtools_manager();
manager->OpenDevToolsWindow(this);
} else {
- ChildProcessSecurityPolicy::GetInstance()->
+ RendererSecurityPolicy::GetInstance()->
GrantInspectElement(process()->pid());
Send(new ViewMsg_ShowJavaScriptConsole(routing_id()));
}
@@ -668,7 +668,7 @@ void RenderViewHost::InstallMissingPlugin() {
}
void RenderViewHost::FileSelected(const FilePath& path) {
- ChildProcessSecurityPolicy::GetInstance()->GrantUploadFile(process()->pid(),
+ RendererSecurityPolicy::GetInstance()->GrantUploadFile(process()->pid(),
path);
std::vector<FilePath> files;
files.push_back(path);
@@ -679,7 +679,7 @@ void RenderViewHost::MultiFilesSelected(
const std::vector<FilePath>& files) {
for (std::vector<FilePath>::const_iterator file = files.begin();
file != files.end(); ++file) {
- ChildProcessSecurityPolicy::GetInstance()->GrantUploadFile(
+ RendererSecurityPolicy::GetInstance()->GrantUploadFile(
process()->pid(), *file);
}
Send(new ViewMsg_RunFileChooserResponse(routing_id(), files));
@@ -906,7 +906,7 @@ void RenderViewHost::OnMsgNavigate(const IPC::Message& msg) {
return;
const int renderer_id = process()->pid();
- ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance();
+ RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance();
// Without this check, an evil renderer can trick the browser into creating
// a navigation entry for a banned URL. If the user clicks the back button
// followed by the forward button (or clicks reload, or round-trips through
@@ -1002,7 +1002,7 @@ void RenderViewHost::OnMsgDidLoadResourceFromMemoryCache(
void RenderViewHost::OnMsgDidStartProvisionalLoadForFrame(bool is_main_frame,
const GURL& url) {
GURL validated_url(url);
- FilterURL(ChildProcessSecurityPolicy::GetInstance(),
+ FilterURL(RendererSecurityPolicy::GetInstance(),
process()->pid(), &validated_url);
delegate_->DidStartProvisionalLoadForFrame(this, is_main_frame,
@@ -1015,7 +1015,7 @@ void RenderViewHost::OnMsgDidFailProvisionalLoadWithError(
const GURL& url,
bool showing_repost_interstitial) {
GURL validated_url(url);
- FilterURL(ChildProcessSecurityPolicy::GetInstance(),
+ FilterURL(RendererSecurityPolicy::GetInstance(),
process()->pid(), &validated_url);
delegate_->DidFailProvisionalLoadWithError(this, is_main_frame,
@@ -1062,7 +1062,7 @@ void RenderViewHost::OnMsgContextMenu(const ContextMenuParams& params) {
// directly, don't show them in the context menu.
ContextMenuParams validated_params(params);
const int renderer_id = process()->pid();
- ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance();
+ RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance();
// We don't validate |unfiltered_link_url| so that this field can be used
// when users want to copy the original link URL.
@@ -1078,7 +1078,7 @@ void RenderViewHost::OnMsgOpenURL(const GURL& url,
const GURL& referrer,
WindowOpenDisposition disposition) {
GURL validated_url(url);
- FilterURL(ChildProcessSecurityPolicy::GetInstance(),
+ FilterURL(RendererSecurityPolicy::GetInstance(),
process()->pid(), &validated_url);
delegate_->RequestOpenURL(validated_url, referrer, disposition);
@@ -1098,7 +1098,7 @@ void RenderViewHost::OnMsgDomOperationResponse(
void RenderViewHost::OnMsgDOMUISend(
const std::string& message, const std::string& content) {
- if (!ChildProcessSecurityPolicy::GetInstance()->
+ if (!RendererSecurityPolicy::GetInstance()->
HasDOMUIBindings(process()->pid())) {
NOTREACHED() << "Blocked unauthorized use of DOMUIBindings.";
return;
diff --git a/chrome/browser/child_process_security_policy.cc b/chrome/browser/renderer_host/renderer_security_policy.cc
index f853c10..dd988ff 100644
--- a/chrome/browser/child_process_security_policy.cc
+++ b/chrome/browser/renderer_host/renderer_security_policy.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/child_process_security_policy.h"
+#include "chrome/browser/renderer_host/renderer_security_policy.h"
#include "base/file_path.h"
#include "base/logging.h"
@@ -14,7 +14,7 @@
// The SecurityState class is used to maintain per-renderer security state
// information.
-class ChildProcessSecurityPolicy::SecurityState {
+class RendererSecurityPolicy::SecurityState {
public:
SecurityState() : has_dom_ui_bindings_(false) { }
~SecurityState() {
@@ -78,7 +78,7 @@ class ChildProcessSecurityPolicy::SecurityState {
DISALLOW_COPY_AND_ASSIGN(SecurityState);
};
-ChildProcessSecurityPolicy::ChildProcessSecurityPolicy() {
+RendererSecurityPolicy::RendererSecurityPolicy() {
// We know about these schemes and believe them to be safe.
RegisterWebSafeScheme(chrome::kHttpScheme);
RegisterWebSafeScheme(chrome::kHttpsScheme);
@@ -93,7 +93,7 @@ ChildProcessSecurityPolicy::ChildProcessSecurityPolicy() {
RegisterPseudoScheme(chrome::kViewSourceScheme);
}
-ChildProcessSecurityPolicy::~ChildProcessSecurityPolicy() {
+RendererSecurityPolicy::~RendererSecurityPolicy() {
web_safe_schemes_.clear();
pseudo_schemes_.clear();
STLDeleteContainerPairSecondPointers(security_state_.begin(),
@@ -102,11 +102,11 @@ ChildProcessSecurityPolicy::~ChildProcessSecurityPolicy() {
}
// static
-ChildProcessSecurityPolicy* ChildProcessSecurityPolicy::GetInstance() {
- return Singleton<ChildProcessSecurityPolicy>::get();
+RendererSecurityPolicy* RendererSecurityPolicy::GetInstance() {
+ return Singleton<RendererSecurityPolicy>::get();
}
-void ChildProcessSecurityPolicy::Add(int renderer_id) {
+void RendererSecurityPolicy::Add(int renderer_id) {
AutoLock lock(lock_);
if (security_state_.count(renderer_id) != 0) {
NOTREACHED() << "Add renderers at most once.";
@@ -116,7 +116,7 @@ void ChildProcessSecurityPolicy::Add(int renderer_id) {
security_state_[renderer_id] = new SecurityState();
}
-void ChildProcessSecurityPolicy::Remove(int renderer_id) {
+void RendererSecurityPolicy::Remove(int renderer_id) {
AutoLock lock(lock_);
if (security_state_.count(renderer_id) != 1) {
NOTREACHED() << "Remove renderers at most once.";
@@ -127,7 +127,7 @@ void ChildProcessSecurityPolicy::Remove(int renderer_id) {
security_state_.erase(renderer_id);
}
-void ChildProcessSecurityPolicy::RegisterWebSafeScheme(const std::string& scheme) {
+void RendererSecurityPolicy::RegisterWebSafeScheme(const std::string& scheme) {
AutoLock lock(lock_);
DCHECK(web_safe_schemes_.count(scheme) == 0) << "Add schemes at most once.";
DCHECK(pseudo_schemes_.count(scheme) == 0) << "Web-safe implies not psuedo.";
@@ -135,13 +135,13 @@ void ChildProcessSecurityPolicy::RegisterWebSafeScheme(const std::string& scheme
web_safe_schemes_.insert(scheme);
}
-bool ChildProcessSecurityPolicy::IsWebSafeScheme(const std::string& scheme) {
+bool RendererSecurityPolicy::IsWebSafeScheme(const std::string& scheme) {
AutoLock lock(lock_);
return (web_safe_schemes_.find(scheme) != web_safe_schemes_.end());
}
-void ChildProcessSecurityPolicy::RegisterPseudoScheme(const std::string& scheme) {
+void RendererSecurityPolicy::RegisterPseudoScheme(const std::string& scheme) {
AutoLock lock(lock_);
DCHECK(pseudo_schemes_.count(scheme) == 0) << "Add schemes at most once.";
DCHECK(web_safe_schemes_.count(scheme) == 0) <<
@@ -150,13 +150,13 @@ void ChildProcessSecurityPolicy::RegisterPseudoScheme(const std::string& scheme)
pseudo_schemes_.insert(scheme);
}
-bool ChildProcessSecurityPolicy::IsPseudoScheme(const std::string& scheme) {
+bool RendererSecurityPolicy::IsPseudoScheme(const std::string& scheme) {
AutoLock lock(lock_);
return (pseudo_schemes_.find(scheme) != pseudo_schemes_.end());
}
-void ChildProcessSecurityPolicy::GrantRequestURL(int renderer_id, const GURL& url) {
+void RendererSecurityPolicy::GrantRequestURL(int renderer_id, const GURL& url) {
if (!url.is_valid())
return; // Can't grant the capability to request invalid URLs.
@@ -190,7 +190,7 @@ void ChildProcessSecurityPolicy::GrantRequestURL(int renderer_id, const GURL& ur
}
}
-void ChildProcessSecurityPolicy::GrantUploadFile(int renderer_id,
+void RendererSecurityPolicy::GrantUploadFile(int renderer_id,
const FilePath& file) {
AutoLock lock(lock_);
@@ -201,7 +201,7 @@ void ChildProcessSecurityPolicy::GrantUploadFile(int renderer_id,
state->second->GrantUploadFile(file);
}
-void ChildProcessSecurityPolicy::GrantInspectElement(int renderer_id) {
+void RendererSecurityPolicy::GrantInspectElement(int renderer_id) {
AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(renderer_id);
@@ -213,7 +213,7 @@ void ChildProcessSecurityPolicy::GrantInspectElement(int renderer_id) {
state->second->GrantScheme(chrome::kChromeUIScheme);
}
-void ChildProcessSecurityPolicy::GrantDOMUIBindings(int renderer_id) {
+void RendererSecurityPolicy::GrantDOMUIBindings(int renderer_id) {
AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(renderer_id);
@@ -229,7 +229,7 @@ void ChildProcessSecurityPolicy::GrantDOMUIBindings(int renderer_id) {
state->second->GrantScheme(chrome::kFileScheme);
}
-bool ChildProcessSecurityPolicy::CanRequestURL(int renderer_id, const GURL& url) {
+bool RendererSecurityPolicy::CanRequestURL(int renderer_id, const GURL& url) {
if (!url.is_valid())
return false; // Can't request invalid URLs.
@@ -270,7 +270,7 @@ bool ChildProcessSecurityPolicy::CanRequestURL(int renderer_id, const GURL& url)
}
}
-bool ChildProcessSecurityPolicy::CanUploadFile(int renderer_id,
+bool RendererSecurityPolicy::CanUploadFile(int renderer_id,
const FilePath& file) {
AutoLock lock(lock_);
@@ -281,7 +281,7 @@ bool ChildProcessSecurityPolicy::CanUploadFile(int renderer_id,
return state->second->CanUploadFile(file);
}
-bool ChildProcessSecurityPolicy::HasDOMUIBindings(int renderer_id) {
+bool RendererSecurityPolicy::HasDOMUIBindings(int renderer_id) {
AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(renderer_id);
diff --git a/chrome/browser/child_process_security_policy.h b/chrome/browser/renderer_host/renderer_security_policy.h
index 9b675cf..41cf04e 100644
--- a/chrome/browser/child_process_security_policy.h
+++ b/chrome/browser/renderer_host/renderer_security_policy.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_
-#define CHROME_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_
+#ifndef CHROME_BROWSER_RENDERER_HOST_RENDERER_SECURITY_POLICY_H_
+#define CHROME_BROWSER_RENDERER_HOST_RENDERER_SECURITY_POLICY_H_
#include <string>
#include <map>
@@ -17,23 +17,23 @@
class FilePath;
class GURL;
-// The ChildProcessSecurityPolicy class is used to grant and revoke security
+// The RendererSecurityPolicy class is used to grant and revoke security
// capabilities for renderers. For example, it restricts whether a renderer
// is permmitted to loaded file:// URLs based on whether the renderer has ever
// been commanded to load file:// URLs by the browser.
//
-// ChildProcessSecurityPolicy is a singleton that may be used on any thread.
+// RendererSecurityPolicy is a singleton that may be used on any thread.
//
-class ChildProcessSecurityPolicy {
+class RendererSecurityPolicy {
public:
// Object can only be created through GetInstance() so the constructor is
// private.
- ~ChildProcessSecurityPolicy();
+ ~RendererSecurityPolicy();
- // There is one global ChildProcessSecurityPolicy object for the entire browser
+ // There is one global RendererSecurityPolicy object for the entire browser
// processes. The object returned by this method may be accessed on any
// thread.
- static ChildProcessSecurityPolicy* GetInstance();
+ static RendererSecurityPolicy* GetInstance();
// Web-safe schemes can be requested by any renderer. Once a web-safe scheme
// has been registered, any renderer processes can request URLs with that
@@ -98,9 +98,9 @@ class ChildProcessSecurityPolicy {
typedef std::set<std::string> SchemeSet;
typedef std::map<int, SecurityState*> SecurityStateMap;
- // Obtain an instance of ChildProcessSecurityPolicy via GetInstance().
- ChildProcessSecurityPolicy();
- friend struct DefaultSingletonTraits<ChildProcessSecurityPolicy>;
+ // Obtain an instance of RendererSecurityPolicy via GetInstance().
+ RendererSecurityPolicy();
+ friend struct DefaultSingletonTraits<RendererSecurityPolicy>;
// You must acquire this lock before reading or writing any members of this
// class. You must not block while holding this lock.
@@ -121,7 +121,7 @@ class ChildProcessSecurityPolicy {
// not escape this class.
SecurityStateMap security_state_;
- DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicy);
+ DISALLOW_COPY_AND_ASSIGN(RendererSecurityPolicy);
};
-#endif // CHROME_BROWSER_CHILD_PROCESS_SECURITY_POLICY_H_
+#endif // CHROME_BROWSER_RENDERER_HOST_RENDERER_SECURITY_POLICY_H_
diff --git a/chrome/browser/child_process_security_policy_unittest.cc b/chrome/browser/renderer_host/renderer_security_policy_unittest.cc
index 88f1e33..2144229 100644
--- a/chrome/browser/child_process_security_policy_unittest.cc
+++ b/chrome/browser/renderer_host/renderer_security_policy_unittest.cc
@@ -6,13 +6,13 @@
#include "base/basictypes.h"
#include "base/file_path.h"
-#include "chrome/browser/child_process_security_policy.h"
+#include "chrome/browser/renderer_host/renderer_security_policy.h"
#include "chrome/common/url_constants.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_test_job.h"
#include "testing/gtest/include/gtest/gtest.h"
-class ChildProcessSecurityPolicyTest : public testing::Test {
+class RendererSecurityPolicyTest : public testing::Test {
protected:
// testing::Test
virtual void SetUp() {
@@ -27,8 +27,8 @@ protected:
static int kRendererID = 42;
-TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, IsWebSafeSchemeTest) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
EXPECT_TRUE(p->IsWebSafeScheme("http"));
EXPECT_TRUE(p->IsWebSafeScheme("https"));
@@ -42,8 +42,8 @@ TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) {
EXPECT_TRUE(p->IsWebSafeScheme("registered-web-safe-scheme"));
}
-TEST_F(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, IsPseudoSchemeTest) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
EXPECT_TRUE(p->IsPseudoScheme("about"));
EXPECT_TRUE(p->IsPseudoScheme("javascript"));
@@ -54,8 +54,8 @@ TEST_F(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) {
EXPECT_TRUE(p->IsPseudoScheme("registered-psuedo-scheme"));
}
-TEST_F(ChildProcessSecurityPolicyTest, StandardSchemesTest) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, StandardSchemesTest) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
p->Add(kRendererID);
@@ -79,8 +79,8 @@ TEST_F(ChildProcessSecurityPolicyTest, StandardSchemesTest) {
p->Remove(kRendererID);
}
-TEST_F(ChildProcessSecurityPolicyTest, AboutTest) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, AboutTest) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
p->Add(kRendererID);
@@ -113,8 +113,8 @@ TEST_F(ChildProcessSecurityPolicyTest, AboutTest) {
p->Remove(kRendererID);
}
-TEST_F(ChildProcessSecurityPolicyTest, JavaScriptTest) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, JavaScriptTest) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
p->Add(kRendererID);
@@ -125,8 +125,8 @@ TEST_F(ChildProcessSecurityPolicyTest, JavaScriptTest) {
p->Remove(kRendererID);
}
-TEST_F(ChildProcessSecurityPolicyTest, RegisterWebSafeSchemeTest) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, RegisterWebSafeSchemeTest) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
p->Add(kRendererID);
@@ -148,8 +148,8 @@ TEST_F(ChildProcessSecurityPolicyTest, RegisterWebSafeSchemeTest) {
p->Remove(kRendererID);
}
-TEST_F(ChildProcessSecurityPolicyTest, CanServiceCommandsTest) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, CanServiceCommandsTest) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
p->Add(kRendererID);
@@ -164,8 +164,8 @@ TEST_F(ChildProcessSecurityPolicyTest, CanServiceCommandsTest) {
p->Remove(kRendererID);
}
-TEST_F(ChildProcessSecurityPolicyTest, ViewSource) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, ViewSource) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
p->Add(kRendererID);
@@ -185,8 +185,8 @@ TEST_F(ChildProcessSecurityPolicyTest, ViewSource) {
p->Remove(kRendererID);
}
-TEST_F(ChildProcessSecurityPolicyTest, CanUploadFiles) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, CanUploadFiles) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
p->Add(kRendererID);
@@ -209,8 +209,8 @@ TEST_F(ChildProcessSecurityPolicyTest, CanUploadFiles) {
p->Remove(kRendererID);
}
-TEST_F(ChildProcessSecurityPolicyTest, CanServiceInspectElement) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, CanServiceInspectElement) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
GURL url("chrome://inspector/inspector.html");
@@ -223,8 +223,8 @@ TEST_F(ChildProcessSecurityPolicyTest, CanServiceInspectElement) {
p->Remove(kRendererID);
}
-TEST_F(ChildProcessSecurityPolicyTest, CanServiceDOMUIBindings) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, CanServiceDOMUIBindings) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
GURL url("chrome://thumb/http://www.google.com/");
@@ -239,8 +239,8 @@ TEST_F(ChildProcessSecurityPolicyTest, CanServiceDOMUIBindings) {
p->Remove(kRendererID);
}
-TEST_F(ChildProcessSecurityPolicyTest, RemoveRace) {
- ChildProcessSecurityPolicy* p = ChildProcessSecurityPolicy::GetInstance();
+TEST_F(RendererSecurityPolicyTest, RemoveRace) {
+ RendererSecurityPolicy* p = RendererSecurityPolicy::GetInstance();
GURL url("file:///etc/passwd");
FilePath file(FILE_PATH_LITERAL("/etc/passwd"));
@@ -258,7 +258,7 @@ TEST_F(ChildProcessSecurityPolicyTest, RemoveRace) {
p->Remove(kRendererID);
// Renderers are added and removed on the UI thread, but the policy can be
- // queried on the IO thread. The ChildProcessSecurityPolicy needs to be prepared
+ // queried on the IO thread. The RendererSecurityPolicy needs to be prepared
// to answer policy questions about renderers who no longer exist.
// In this case, we default to secure behavior.
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index e091819..3f0075b 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -13,7 +13,6 @@
#include "base/stl_util-inl.h"
#include "base/time.h"
#include "chrome/browser/cert_store.h"
-#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/cross_site_request_manager.h"
#include "chrome/browser/download/download_file.h"
#include "chrome/browser/download/download_manager.h"
@@ -28,6 +27,7 @@
#include "chrome/browser/renderer_host/download_resource_handler.h"
#include "chrome/browser/renderer_host/media_resource_handler.h"
#include "chrome/browser/renderer_host/render_view_host.h"
+#include "chrome/browser/renderer_host/renderer_security_policy.h"
#include "chrome/browser/renderer_host/resource_request_details.h"
#include "chrome/browser/renderer_host/safe_browsing_resource_handler.h"
#include "chrome/browser/renderer_host/save_file_resource_handler.h"
@@ -109,7 +109,7 @@ bool ShouldServiceRequest(ChildProcessInfo::ProcessType process_type,
if (process_type != ChildProcessInfo::RENDER_PROCESS)
return true;
- ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance();
+ RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance();
// Check if the renderer is permitted to request the requested URL.
if (!policy->CanRequestURL(process_id, request_data.url)) {
@@ -484,7 +484,7 @@ void ResourceDispatcherHost::BeginDownload(const GURL& url,
return;
// Check if the renderer is permitted to request the requested URL.
- if (!ChildProcessSecurityPolicy::GetInstance()->
+ if (!RendererSecurityPolicy::GetInstance()->
CanRequestURL(process_id, url)) {
LOG(INFO) << "Denied unauthorized download request for " <<
url.possibly_invalid_spec();
@@ -821,7 +821,7 @@ void ResourceDispatcherHost::OnReceivedRedirect(URLRequest* request,
DCHECK(request->status().is_success());
if (info->process_type == ChildProcessInfo::RENDER_PROCESS &&
- !ChildProcessSecurityPolicy::GetInstance()->
+ !RendererSecurityPolicy::GetInstance()->
CanRequestURL(info->process_id, new_url)) {
LOG(INFO) << "Denied unauthorized request for " <<
new_url.possibly_invalid_spec();
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
index 6278d3e..1e2b458 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
@@ -7,7 +7,7 @@
#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/process_util.h"
-#include "chrome/browser/child_process_security_policy.h"
+#include "chrome/browser/renderer_host/renderer_security_policy.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/render_messages.h"
@@ -112,13 +112,13 @@ class ResourceDispatcherHostTest : public testing::Test,
protected:
// testing::Test
virtual void SetUp() {
- ChildProcessSecurityPolicy::GetInstance()->Add(0);
+ RendererSecurityPolicy::GetInstance()->Add(0);
URLRequest::RegisterProtocolFactory("test", &URLRequestTestJob::Factory);
EnsureTestSchemeIsAllowed();
}
virtual void TearDown() {
URLRequest::RegisterProtocolFactory("test", NULL);
- ChildProcessSecurityPolicy::GetInstance()->Remove(0);
+ RendererSecurityPolicy::GetInstance()->Remove(0);
// The plugin lib is automatically loaded during these test
// and we want a clean environment for other tests.
@@ -143,7 +143,7 @@ class ResourceDispatcherHostTest : public testing::Test,
static bool have_white_listed_test_scheme = false;
if (!have_white_listed_test_scheme) {
- ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme("test");
+ RendererSecurityPolicy::GetInstance()->RegisterWebSafeScheme("test");
have_white_listed_test_scheme = true;
}
}
diff --git a/chrome/test/unit/unittests.vcproj b/chrome/test/unit/unittests.vcproj
index 187bdfa..348bfbb 100644
--- a/chrome/test/unit/unittests.vcproj
+++ b/chrome/test/unit/unittests.vcproj
@@ -452,10 +452,6 @@
>
</File>
<File
- RelativePath="..\..\browser\child_process_security_policy_unittest.cc"
- >
- </File>
- <File
RelativePath="..\..\browser\chrome_thread_unittest.cc"
>
</File>
@@ -672,6 +668,10 @@
>
</File>
<File
+ RelativePath="..\..\browser\renderer_host\renderer_security_policy_unittest.cc"
+ >
+ </File>
+ <File
RelativePath="..\..\browser\net\resolve_proxy_msg_helper_unittest.cc"
>
</File>