| 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);
|
| +}
|
|
|