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

Side by Side Diff: chrome/browser/renderer_security_policy.cc

Issue 12418: Implement History as HTML and add/change a bunch of stuff to make it easier t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_security_policy.h" 5 #include "chrome/browser/renderer_security_policy.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #ifdef CHROME_PERSONALIZATION 9 #ifdef CHROME_PERSONALIZATION
10 #include "chrome/personalization/personalization.h" 10 #include "chrome/personalization/personalization.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 state->second->GrantUploadFile(file); 188 state->second->GrantUploadFile(file);
189 } 189 }
190 190
191 void RendererSecurityPolicy::GrantInspectElement(int renderer_id) { 191 void RendererSecurityPolicy::GrantInspectElement(int renderer_id) {
192 AutoLock lock(lock_); 192 AutoLock lock(lock_);
193 193
194 SecurityStateMap::iterator state = security_state_.find(renderer_id); 194 SecurityStateMap::iterator state = security_state_.find(renderer_id);
195 if (state == security_state_.end()) 195 if (state == security_state_.end())
196 return; 196 return;
197 197
198 // The inspector is served from a chrome-resource: URL. In order to run the 198 // The inspector is served from a chrome: URL. In order to run the
199 // inspector, the renderer needs to be able to load chrome-resource URLs. 199 // inspector, the renderer needs to be able to load chrome URLs.
200 state->second->GrantScheme("chrome-resource"); 200 state->second->GrantScheme("chrome");
201 } 201 }
202 202
203 void RendererSecurityPolicy::GrantDOMUIBindings(int renderer_id) { 203 void RendererSecurityPolicy::GrantDOMUIBindings(int renderer_id) {
204 AutoLock lock(lock_); 204 AutoLock lock(lock_);
205 205
206 SecurityStateMap::iterator state = security_state_.find(renderer_id); 206 SecurityStateMap::iterator state = security_state_.find(renderer_id);
207 if (state == security_state_.end()) 207 if (state == security_state_.end())
208 return; 208 return;
209 209
210 state->second->GrantDOMUIBindings(); 210 state->second->GrantDOMUIBindings();
211 211
212 // DOM UI bindings need the ability to request chrome-resource URLs. 212 // DOM UI bindings need the ability to request chrome URLs.
213 state->second->GrantScheme("chrome-resource"); 213 state->second->GrantScheme("chrome");
214 214
215 // DOM UI pages can contain links to file:// URLs. 215 // DOM UI pages can contain links to file:// URLs.
216 state->second->GrantScheme("file"); 216 state->second->GrantScheme("file");
217 } 217 }
218 218
219 bool RendererSecurityPolicy::CanRequestURL(int renderer_id, const GURL& url) { 219 bool RendererSecurityPolicy::CanRequestURL(int renderer_id, const GURL& url) {
220 if (!url.is_valid()) 220 if (!url.is_valid())
221 return false; // Can't request invalid URLs. 221 return false; // Can't request invalid URLs.
222 222
223 if (IsWebSafeScheme(url.scheme())) 223 if (IsWebSafeScheme(url.scheme()))
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 bool RendererSecurityPolicy::HasDOMUIBindings(int renderer_id) { 276 bool RendererSecurityPolicy::HasDOMUIBindings(int renderer_id) {
277 AutoLock lock(lock_); 277 AutoLock lock(lock_);
278 278
279 SecurityStateMap::iterator state = security_state_.find(renderer_id); 279 SecurityStateMap::iterator state = security_state_.find(renderer_id);
280 if (state == security_state_.end()) 280 if (state == security_state_.end())
281 return false; 281 return false;
282 282
283 return state->second->has_dom_ui_bindings(); 283 return state->second->has_dom_ui_bindings();
284 } 284 }
285 285
OLDNEW
« no previous file with comments | « chrome/browser/render_view_context_menu_controller.cc ('k') | chrome/browser/renderer_security_policy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698