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

Unified Diff: chrome/browser/renderer_host/renderer_security_policy.cc

Issue 100321: Track which NativeViewIds each render process is allowed to interact with. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/renderer_security_policy.cc
===================================================================
--- chrome/browser/renderer_host/renderer_security_policy.cc (revision 14874)
+++ chrome/browser/renderer_host/renderer_security_policy.cc (working copy)
@@ -36,6 +36,10 @@
has_dom_ui_bindings_ = true;
}
+ void GrantNativeViewId(gfx::NativeViewId view_id) {
+ native_view_ids_.insert(view_id);
+ }
+
// Determine whether permission has been granted to request url.
// Schemes that have not been granted default to being denied.
bool CanRequestURL(const GURL& url) {
@@ -55,9 +59,14 @@
bool has_dom_ui_bindings() const { return has_dom_ui_bindings_; }
+ bool HasNativeViewId(gfx::NativeViewId view_id) {
+ return native_view_ids_.find(view_id) != native_view_ids_.end();
+ }
+
private:
typedef std::map<std::string, bool> SchemeMap;
typedef std::set<FilePath> FileSet;
+ typedef std::set<gfx::NativeViewId> NativeViewIdSet;
// Maps URL schemes to whether permission has been granted or revoked:
// |true| means the scheme has been granted.
@@ -69,6 +78,9 @@
// The set of files the renderer is permited to upload to the web.
FileSet uploadable_files_;
+ // The set of gfx::NativeViewIds the renderer is permitted to interact with.
+ NativeViewIdSet native_view_ids_;
+
bool has_dom_ui_bindings_;
DISALLOW_COPY_AND_ASSIGN(SecurityState);
@@ -217,6 +229,17 @@
state->second->GrantScheme(chrome::kFileScheme);
}
+void RendererSecurityPolicy::GrantNativeViewId(int renderer_id,
+ gfx::NativeViewId view_id) {
+ AutoLock lock(lock_);
+
+ SecurityStateMap::iterator state = security_state_.find(renderer_id);
+ if (state == security_state_.end())
+ return;
+
+ state->second->GrantNativeViewId(view_id);
+}
+
bool RendererSecurityPolicy::CanRequestURL(int renderer_id, const GURL& url) {
if (!url.is_valid())
return false; // Can't request invalid URLs.
@@ -278,3 +301,14 @@
return state->second->has_dom_ui_bindings();
}
+
+bool RendererSecurityPolicy::HasNativeViewId(int renderer_id,
+ gfx::NativeViewId view_id) {
+ AutoLock lock(lock_);
+
+ SecurityStateMap::iterator state = security_state_.find(renderer_id);
+ if (state == security_state_.end())
+ return false;
+
+ return state->second->HasNativeViewId(view_id);
+}
« no previous file with comments | « chrome/browser/renderer_host/renderer_security_policy.h ('k') | chrome/browser/renderer_host/resource_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698