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

Unified Diff: content/browser/child_process_security_policy.cc

Issue 8588039: Remove "open in new tab" items from context menu if the process doesn't (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/child_process_security_policy.cc
===================================================================
--- content/browser/child_process_security_policy.cc (revision 113019)
+++ content/browser/child_process_security_policy.cc (working copy)
@@ -11,10 +11,12 @@
#include "base/stl_util.h"
#include "base/string_util.h"
#include "content/browser/site_instance.h"
+#include "content/public/browser/content_browser_client.h"
#include "content/public/common/bindings_policy.h"
#include "content/public/common/url_constants.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_job_factory.h"
static const int kReadFilePermissions =
base::PLATFORM_FILE_OPEN |
@@ -201,9 +203,9 @@
web_safe_schemes_.insert(scheme);
}
-bool ChildProcessSecurityPolicy::IsWebSafeScheme(const std::string& scheme) {
+bool ChildProcessSecurityPolicy::IsWebSafeScheme(
+ const std::string& scheme) const {
base::AutoLock lock(lock_);
-
return (web_safe_schemes_.find(scheme) != web_safe_schemes_.end());
}
@@ -217,9 +219,9 @@
pseudo_schemes_.insert(scheme);
}
-bool ChildProcessSecurityPolicy::IsPseudoScheme(const std::string& scheme) {
+bool ChildProcessSecurityPolicy::IsPseudoScheme(
+ const std::string& scheme) const {
base::AutoLock lock(lock_);
-
return (pseudo_schemes_.find(scheme) != pseudo_schemes_.end());
}
@@ -229,7 +231,8 @@
disabled_schemes_ = schemes;
}
-bool ChildProcessSecurityPolicy::IsDisabledScheme(const std::string& scheme) {
+bool ChildProcessSecurityPolicy::IsDisabledScheme(
+ const std::string& scheme) const {
base::AutoLock lock(lock_);
return disabled_schemes_.find(scheme) != disabled_schemes_.end();
}
@@ -349,7 +352,9 @@
}
bool ChildProcessSecurityPolicy::CanRequestURL(
- int child_id, const GURL& url) {
+ int child_id,
+ const GURL& url,
+ const net::URLRequestJobFactory* job_factory) const {
if (!url.is_valid())
return false; // Can't request invalid URLs.
@@ -370,7 +375,7 @@
url.SchemeIs(chrome::kViewSourceScheme))
return false;
- return CanRequestURL(child_id, child_url);
+ return CanRequestURL(child_id, child_url, NULL);
}
if (LowerCaseEqualsASCII(url.spec(), chrome::kAboutBlankURL))
@@ -382,13 +387,18 @@
return false;
}
- if (!net::URLRequest::IsHandledURL(url))
- return true; // This URL request is destined for ShellExecute.
+ if (job_factory) {
+ if (!job_factory->IsHandledURL(url))
+ return true;
+ } else {
+ if (!content::GetContentClient()->browser()->IsHandledURL(url))
+ return true;
+ }
{
base::AutoLock lock(lock_);
- SecurityStateMap::iterator state = security_state_.find(child_id);
+ SecurityStateMap::const_iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return false;

Powered by Google App Engine
This is Rietveld 408576698