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 "chrome/common/ssl_insecure_content.h" | 7 #include "chrome/common/ssl_insecure_content.h" |
8 #include "components/content_settings/content/common/content_settings_messages.h
" | 8 #include "components/content_settings/content/common/content_settings_messages.h
" |
9 #include "content/public/common/url_constants.h" | 9 #include "content/public/common/url_constants.h" |
10 #include "content/public/renderer/document_state.h" | 10 #include "content/public/renderer/document_state.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 382 } |
383 } | 383 } |
384 #endif | 384 #endif |
385 return allowed; | 385 return allowed; |
386 } | 386 } |
387 | 387 |
388 bool ContentSettingsObserver::allowMutationEvents(bool default_value) { | 388 bool ContentSettingsObserver::allowMutationEvents(bool default_value) { |
389 return IsPlatformApp() ? false : default_value; | 389 return IsPlatformApp() ? false : default_value; |
390 } | 390 } |
391 | 391 |
392 bool ContentSettingsObserver::allowDisplayingInsecureContent( | |
393 bool allowed_per_settings, | |
394 const blink::WebURL& resource_url) { | |
395 DCHECK(allowed_per_settings); | |
396 ReportInsecureContent(SslInsecureContentType::DISPLAY); | |
397 FilteredReportInsecureContentDisplayed(GURL(resource_url)); | |
398 return true; | |
399 } | |
400 | |
401 bool ContentSettingsObserver::allowRunningInsecureContent( | 392 bool ContentSettingsObserver::allowRunningInsecureContent( |
402 bool allowed_per_settings, | 393 bool allowed_per_settings, |
403 const blink::WebSecurityOrigin& origin, | 394 const blink::WebSecurityOrigin& origin, |
404 const blink::WebURL& resource_url) { | 395 const blink::WebURL& resource_url) { |
405 FilteredReportInsecureContentRan(GURL(resource_url)); | 396 FilteredReportInsecureContentRan(GURL(resource_url)); |
406 | 397 |
407 if (!allow_running_insecure_content_ && !allowed_per_settings) { | 398 if (!allow_running_insecure_content_ && !allowed_per_settings) { |
408 DidBlockContentType(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT); | 399 DidBlockContentType(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT); |
409 return false; | 400 return false; |
410 } | 401 } |
411 | 402 |
412 return true; | 403 return true; |
413 } | 404 } |
414 | 405 |
415 bool ContentSettingsObserver::allowAutoplay(bool default_value) { | 406 bool ContentSettingsObserver::allowAutoplay(bool default_value) { |
416 if (!content_setting_rules_) | 407 if (!content_setting_rules_) |
417 return default_value; | 408 return default_value; |
418 | 409 |
419 WebFrame* frame = render_frame()->GetWebFrame(); | 410 WebFrame* frame = render_frame()->GetWebFrame(); |
420 return GetContentSettingFromRules( | 411 return GetContentSettingFromRules( |
421 content_setting_rules_->autoplay_rules, frame, | 412 content_setting_rules_->autoplay_rules, frame, |
422 blink::WebStringToGURL( | 413 blink::WebStringToGURL( |
423 frame->document().getSecurityOrigin().toString())) == | 414 frame->document().getSecurityOrigin().toString())) == |
424 CONTENT_SETTING_ALLOW; | 415 CONTENT_SETTING_ALLOW; |
425 } | 416 } |
426 | 417 |
| 418 void ContentSettingsObserver::passiveInsecureContentFound( |
| 419 const blink::WebURL& resource_url) { |
| 420 ReportInsecureContent(SslInsecureContentType::DISPLAY); |
| 421 FilteredReportInsecureContentDisplayed(GURL(resource_url)); |
| 422 } |
| 423 |
427 void ContentSettingsObserver::didUseKeygen() { | 424 void ContentSettingsObserver::didUseKeygen() { |
428 WebFrame* frame = render_frame()->GetWebFrame(); | 425 WebFrame* frame = render_frame()->GetWebFrame(); |
429 Send(new ChromeViewHostMsg_DidUseKeygen( | 426 Send(new ChromeViewHostMsg_DidUseKeygen( |
430 routing_id(), | 427 routing_id(), |
431 blink::WebStringToGURL(frame->getSecurityOrigin().toString()))); | 428 blink::WebStringToGURL(frame->getSecurityOrigin().toString()))); |
432 } | 429 } |
433 | 430 |
434 void ContentSettingsObserver::didNotAllowPlugins() { | 431 void ContentSettingsObserver::didNotAllowPlugins() { |
435 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS); | 432 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS); |
436 } | 433 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 541 |
545 // If the scheme is file:, an empty file name indicates a directory listing, | 542 // If the scheme is file:, an empty file name indicates a directory listing, |
546 // which requires JavaScript to function properly. | 543 // which requires JavaScript to function properly. |
547 if (base::EqualsASCII(protocol, url::kFileScheme)) { | 544 if (base::EqualsASCII(protocol, url::kFileScheme)) { |
548 return document_url.SchemeIs(url::kFileScheme) && | 545 return document_url.SchemeIs(url::kFileScheme) && |
549 document_url.ExtractFileName().empty(); | 546 document_url.ExtractFileName().empty(); |
550 } | 547 } |
551 | 548 |
552 return false; | 549 return false; |
553 } | 550 } |
OLD | NEW |