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