Chromium Code Reviews| 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 "components/content_settings/content/common/content_settings_messages.h " | 9 #include "components/content_settings/content/common/content_settings_messages.h " |
| 10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 SendInsecureContentSignal(INSECURE_CONTENT_RUN_SWF); | 479 SendInsecureContentSignal(INSECURE_CONTENT_RUN_SWF); |
| 480 | 480 |
| 481 if (!allow_running_insecure_content_ && !allowed_per_settings) { | 481 if (!allow_running_insecure_content_ && !allowed_per_settings) { |
| 482 DidBlockContentType(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, origin.host()); | 482 DidBlockContentType(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, origin.host()); |
| 483 return false; | 483 return false; |
| 484 } | 484 } |
| 485 | 485 |
| 486 return true; | 486 return true; |
| 487 } | 487 } |
| 488 | 488 |
| 489 bool ContentSettingsObserver::allowAutoplay(bool default_value) { | |
| 490 if (!content_setting_rules_) | |
| 491 return default_value; | |
| 492 | |
| 493 WebFrame* frame = render_frame()->GetWebFrame(); | |
| 494 return GetContentSettingFromRules( | |
| 495 content_setting_rules_->autoplay_rules, frame, | |
| 496 blink::WebStringToGURL( | |
| 497 frame->document().getSecurityOrigin().toString())) == | |
|
raymes
2016/04/21 04:01:56
Resolving content settings this way isn't great be
Bernhard Bauer
2016/04/21 08:20:44
Hm... it might be possible to make sure that the l
| |
| 498 CONTENT_SETTING_ALLOW; | |
| 499 } | |
| 500 | |
| 489 void ContentSettingsObserver::didUseKeygen() { | 501 void ContentSettingsObserver::didUseKeygen() { |
| 490 WebFrame* frame = render_frame()->GetWebFrame(); | 502 WebFrame* frame = render_frame()->GetWebFrame(); |
| 491 Send(new ChromeViewHostMsg_DidUseKeygen( | 503 Send(new ChromeViewHostMsg_DidUseKeygen( |
| 492 routing_id(), | 504 routing_id(), |
| 493 blink::WebStringToGURL(frame->getSecurityOrigin().toString()))); | 505 blink::WebStringToGURL(frame->getSecurityOrigin().toString()))); |
| 494 } | 506 } |
| 495 | 507 |
| 496 void ContentSettingsObserver::didNotAllowPlugins() { | 508 void ContentSettingsObserver::didNotAllowPlugins() { |
| 497 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS); | 509 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS); |
| 498 } | 510 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 611 | 623 |
| 612 // If the scheme is file:, an empty file name indicates a directory listing, | 624 // If the scheme is file:, an empty file name indicates a directory listing, |
| 613 // which requires JavaScript to function properly. | 625 // which requires JavaScript to function properly. |
| 614 if (base::EqualsASCII(protocol, url::kFileScheme)) { | 626 if (base::EqualsASCII(protocol, url::kFileScheme)) { |
| 615 return document_url.SchemeIs(url::kFileScheme) && | 627 return document_url.SchemeIs(url::kFileScheme) && |
| 616 document_url.ExtractFileName().empty(); | 628 document_url.ExtractFileName().empty(); |
| 617 } | 629 } |
| 618 | 630 |
| 619 return false; | 631 return false; |
| 620 } | 632 } |
| OLD | NEW |