| 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/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_YOUTUBE); | 666 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_YOUTUBE); |
| 667 } | 667 } |
| 668 | 668 |
| 669 GURL resource_gurl(resource_url); | 669 GURL resource_gurl(resource_url); |
| 670 if (EndsWith(resource_gurl.path(), kDotHTML, false)) | 670 if (EndsWith(resource_gurl.path(), kDotHTML, false)) |
| 671 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HTML); | 671 SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HTML); |
| 672 | 672 |
| 673 if (allowed_per_settings || allow_displaying_insecure_content_) | 673 if (allowed_per_settings || allow_displaying_insecure_content_) |
| 674 return true; | 674 return true; |
| 675 | 675 |
| 676 if (!IsStrictSecurityHost(origin_host)) | 676 Send(new ChromeViewHostMsg_DidBlockDisplayingInsecureContent(routing_id())); |
| 677 Send(new ChromeViewHostMsg_DidBlockDisplayingInsecureContent(routing_id())); | |
| 678 | 677 |
| 679 return false; | 678 return false; |
| 680 } | 679 } |
| 681 | 680 |
| 682 bool ChromeRenderViewObserver::allowRunningInsecureContent( | 681 bool ChromeRenderViewObserver::allowRunningInsecureContent( |
| 683 WebKit::WebFrame* frame, | 682 WebKit::WebFrame* frame, |
| 684 bool allowed_per_settings, | 683 bool allowed_per_settings, |
| 685 const WebKit::WebSecurityOrigin& origin, | 684 const WebKit::WebSecurityOrigin& origin, |
| 686 const WebKit::WebURL& resource_url) { | 685 const WebKit::WebURL& resource_url) { |
| 687 std::string origin_host(origin.host().utf8()); | 686 std::string origin_host(origin.host().utf8()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 SendInsecureContentSignal(INSECURE_CONTENT_RUN_TARGET_YOUTUBE); | 730 SendInsecureContentSignal(INSECURE_CONTENT_RUN_TARGET_YOUTUBE); |
| 732 | 731 |
| 733 if (EndsWith(resource_gurl.path(), kDotJS, false)) | 732 if (EndsWith(resource_gurl.path(), kDotJS, false)) |
| 734 SendInsecureContentSignal(INSECURE_CONTENT_RUN_JS); | 733 SendInsecureContentSignal(INSECURE_CONTENT_RUN_JS); |
| 735 else if (EndsWith(resource_gurl.path(), kDotCSS, false)) | 734 else if (EndsWith(resource_gurl.path(), kDotCSS, false)) |
| 736 SendInsecureContentSignal(INSECURE_CONTENT_RUN_CSS); | 735 SendInsecureContentSignal(INSECURE_CONTENT_RUN_CSS); |
| 737 else if (EndsWith(resource_gurl.path(), kDotSWF, false)) | 736 else if (EndsWith(resource_gurl.path(), kDotSWF, false)) |
| 738 SendInsecureContentSignal(INSECURE_CONTENT_RUN_SWF); | 737 SendInsecureContentSignal(INSECURE_CONTENT_RUN_SWF); |
| 739 | 738 |
| 740 if (!allow_running_insecure_content_ && !allowed_per_settings) { | 739 if (!allow_running_insecure_content_ && !allowed_per_settings) { |
| 741 if (!IsStrictSecurityHost(origin_host)) | 740 content_settings_->DidNotAllowMixedScript(); |
| 742 content_settings_->DidNotAllowMixedScript(); | |
| 743 return false; | 741 return false; |
| 744 } | 742 } |
| 745 | 743 |
| 746 return true; | 744 return true; |
| 747 } | 745 } |
| 748 | 746 |
| 749 void ChromeRenderViewObserver::didNotAllowPlugins(WebFrame* frame) { | 747 void ChromeRenderViewObserver::didNotAllowPlugins(WebFrame* frame) { |
| 750 content_settings_->DidNotAllowPlugins(); | 748 content_settings_->DidNotAllowPlugins(); |
| 751 } | 749 } |
| 752 | 750 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 WebElement element = node.to<WebElement>(); | 1007 WebElement element = node.to<WebElement>(); |
| 1010 if (!element.hasTagName(tag_name)) | 1008 if (!element.hasTagName(tag_name)) |
| 1011 continue; | 1009 continue; |
| 1012 WebString value = element.getAttribute(attribute_name); | 1010 WebString value = element.getAttribute(attribute_name); |
| 1013 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) | 1011 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) |
| 1014 continue; | 1012 continue; |
| 1015 return true; | 1013 return true; |
| 1016 } | 1014 } |
| 1017 return false; | 1015 return false; |
| 1018 } | 1016 } |
| OLD | NEW |