OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/content_settings_observer.h" | 5 #include "chrome/renderer/content_settings_observer.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 | 228 |
229 GURL url = frame->document().url(); | 229 GURL url = frame->document().url(); |
230 // If we start failing this DCHECK, please makes sure we don't regress | 230 // If we start failing this DCHECK, please makes sure we don't regress |
231 // this bug: http://code.google.com/p/chromium/issues/detail?id=79304 | 231 // this bug: http://code.google.com/p/chromium/issues/detail?id=79304 |
232 DCHECK(frame->document().securityOrigin().toString() == "null" || | 232 DCHECK(frame->document().securityOrigin().toString() == "null" || |
233 !url.SchemeIs(content::kDataScheme)); | 233 !url.SchemeIs(content::kDataScheme)); |
234 } | 234 } |
235 | 235 |
236 bool ContentSettingsObserver::allowDatabase( | 236 bool ContentSettingsObserver::allowDatabase( |
237 blink::WebFrame* frame, | 237 blink::WebLocalFrame* frame, |
238 const blink::WebString& name, | 238 const blink::WebString& name, |
239 const blink::WebString& display_name, | 239 const blink::WebString& display_name, |
240 unsigned long estimated_size) { | 240 unsigned long estimated_size) { |
241 return allowDatabase(name, display_name, estimated_size); | 241 return allowDatabase(name, display_name, estimated_size); |
242 } | 242 } |
243 | 243 |
244 bool ContentSettingsObserver::allowFileSystem(blink::WebFrame* frame) { | 244 bool ContentSettingsObserver::allowFileSystem(blink::WebLocalFrame* frame) { |
245 return allowFileSystem(); | 245 return allowFileSystem(); |
246 } | 246 } |
247 | 247 |
248 bool ContentSettingsObserver::allowImage(blink::WebFrame* frame, | 248 bool ContentSettingsObserver::allowImage(blink::WebLocalFrame* frame, |
249 bool enabled_per_settings, | 249 bool enabled_per_settings, |
250 const blink::WebURL& image_url) { | 250 const blink::WebURL& image_url) { |
251 return allowImage(enabled_per_settings, image_url); | 251 return allowImage(enabled_per_settings, image_url); |
252 } | 252 } |
253 | 253 |
254 bool ContentSettingsObserver::allowIndexedDB( | 254 bool ContentSettingsObserver::allowIndexedDB( |
255 blink::WebFrame* frame, | 255 blink::WebLocalFrame* frame, |
256 const blink::WebString& name, | 256 const blink::WebString& name, |
257 const blink::WebSecurityOrigin& origin) { | 257 const blink::WebSecurityOrigin& origin) { |
258 return allowIndexedDB(name, origin); | 258 return allowIndexedDB(name, origin); |
259 } | 259 } |
260 | 260 |
261 bool ContentSettingsObserver::allowPlugins(blink::WebFrame* frame, | 261 bool ContentSettingsObserver::allowPlugins(blink::WebLocalFrame* frame, |
262 bool enabled_per_settings) { | 262 bool enabled_per_settings) { |
263 return allowPlugins(enabled_per_settings); | 263 return allowPlugins(enabled_per_settings); |
264 } | 264 } |
265 | 265 |
266 bool ContentSettingsObserver::allowScript(blink::WebFrame* frame, | 266 bool ContentSettingsObserver::allowScript(blink::WebLocalFrame* frame, |
267 bool enabled_per_settings) { | 267 bool enabled_per_settings) { |
268 return allowScript(enabled_per_settings); | 268 return allowScript(enabled_per_settings); |
269 } | 269 } |
270 | 270 |
271 bool ContentSettingsObserver::allowScriptFromSource( | 271 bool ContentSettingsObserver::allowScriptFromSource( |
272 blink::WebFrame* frame, | 272 blink::WebLocalFrame* frame, |
273 bool enabled_per_settings, | 273 bool enabled_per_settings, |
274 const blink::WebURL& script_url) { | 274 const blink::WebURL& script_url) { |
275 return allowScriptFromSource(enabled_per_settings, script_url); | 275 return allowScriptFromSource(enabled_per_settings, script_url); |
276 } | 276 } |
277 | 277 |
278 bool ContentSettingsObserver::allowStorage(blink::WebFrame* frame, bool local) { | 278 bool ContentSettingsObserver::allowStorage(blink::WebLocalFrame* frame, |
| 279 bool local) { |
279 return allowStorage(local); | 280 return allowStorage(local); |
280 } | 281 } |
281 | 282 |
282 bool ContentSettingsObserver::allowReadFromClipboard(blink::WebFrame* frame, | 283 bool ContentSettingsObserver::allowReadFromClipboard( |
283 bool default_value) { | 284 blink::WebLocalFrame* frame, |
| 285 bool default_value) { |
284 return allowReadFromClipboard(default_value); | 286 return allowReadFromClipboard(default_value); |
285 } | 287 } |
286 | 288 |
287 bool ContentSettingsObserver::allowWriteToClipboard(blink::WebFrame* frame, | 289 bool ContentSettingsObserver::allowWriteToClipboard(blink::WebLocalFrame* frame, |
288 bool default_value) { | 290 bool default_value) { |
289 return allowWriteToClipboard(default_value); | 291 return allowWriteToClipboard(default_value); |
290 } | 292 } |
291 | 293 |
292 bool ContentSettingsObserver::allowWebComponents(blink::WebFrame* frame, | 294 bool ContentSettingsObserver::allowWebComponents(blink::WebLocalFrame* frame, |
293 bool default_value) { | 295 bool default_value) { |
294 return allowWebComponents(default_value); | 296 return allowWebComponents(default_value); |
295 } | 297 } |
296 | 298 |
297 bool ContentSettingsObserver::allowMutationEvents(blink::WebFrame* frame, | 299 bool ContentSettingsObserver::allowMutationEvents(blink::WebLocalFrame* frame, |
298 bool default_value) { | 300 bool default_value) { |
299 return allowMutationEvents(default_value); | 301 return allowMutationEvents(default_value); |
300 } | 302 } |
301 | 303 |
302 bool ContentSettingsObserver::allowPushState(blink::WebFrame* frame) { | 304 bool ContentSettingsObserver::allowPushState(blink::WebLocalFrame* frame) { |
303 return allowPushState(); | 305 return allowPushState(); |
304 } | 306 } |
305 | 307 |
306 void ContentSettingsObserver::didNotAllowPlugins(blink::WebFrame* frame) { | 308 void ContentSettingsObserver::didNotAllowPlugins(blink::WebLocalFrame* frame) { |
307 return didNotAllowPlugins(); | 309 return didNotAllowPlugins(); |
308 } | 310 } |
309 | 311 |
310 void ContentSettingsObserver::didNotAllowScript(blink::WebFrame* frame) { | 312 void ContentSettingsObserver::didNotAllowScript(blink::WebLocalFrame* frame) { |
311 return didNotAllowScript(); | 313 return didNotAllowScript(); |
312 } | 314 } |
313 | 315 |
314 bool ContentSettingsObserver::allowDisplayingInsecureContent( | 316 bool ContentSettingsObserver::allowDisplayingInsecureContent( |
315 blink::WebFrame* frame, | 317 blink::WebLocalFrame* frame, |
316 bool allowed_per_settings, | 318 bool allowed_per_settings, |
317 const blink::WebSecurityOrigin& context, | 319 const blink::WebSecurityOrigin& context, |
318 const blink::WebURL& url) { | 320 const blink::WebURL& url) { |
319 return allowDisplayingInsecureContent(allowed_per_settings, context, url); | 321 return allowDisplayingInsecureContent(allowed_per_settings, context, url); |
320 } | 322 } |
321 | 323 |
322 bool ContentSettingsObserver::allowRunningInsecureContent( | 324 bool ContentSettingsObserver::allowRunningInsecureContent( |
323 blink::WebFrame* frame, | 325 blink::WebLocalFrame* frame, |
324 bool allowed_per_settings, | 326 bool allowed_per_settings, |
325 const blink::WebSecurityOrigin& context, | 327 const blink::WebSecurityOrigin& context, |
326 const blink::WebURL& url) { | 328 const blink::WebURL& url) { |
327 return allowRunningInsecureContent(allowed_per_settings, context, url); | 329 return allowRunningInsecureContent(allowed_per_settings, context, url); |
328 } | 330 } |
329 | 331 |
330 bool ContentSettingsObserver::allowDatabase(const WebString& name, | 332 bool ContentSettingsObserver::allowDatabase(const WebString& name, |
331 const WebString& display_name, | 333 const WebString& display_name, |
332 unsigned long estimated_size) { | 334 unsigned long estimated_size) { |
333 WebFrame* frame = render_frame()->GetWebFrame(); | 335 WebFrame* frame = render_frame()->GetWebFrame(); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 | 748 |
747 // If the scheme is file:, an empty file name indicates a directory listing, | 749 // If the scheme is file:, an empty file name indicates a directory listing, |
748 // which requires JavaScript to function properly. | 750 // which requires JavaScript to function properly. |
749 if (EqualsASCII(origin.protocol(), content::kFileScheme)) { | 751 if (EqualsASCII(origin.protocol(), content::kFileScheme)) { |
750 return document_url.SchemeIs(content::kFileScheme) && | 752 return document_url.SchemeIs(content::kFileScheme) && |
751 document_url.ExtractFileName().empty(); | 753 document_url.ExtractFileName().empty(); |
752 } | 754 } |
753 | 755 |
754 return false; | 756 return false; |
755 } | 757 } |
OLD | NEW |