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 "content/renderer/npapi/webplugin_impl.h" | 5 #include "content/renderer/npapi/webplugin_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 clients_[i].loader->cancel(); | 756 clients_[i].loader->cancel(); |
757 if (clients_[i].client) | 757 if (clients_[i].client) |
758 clients_[i].client->DidFail(clients_[i].id); | 758 clients_[i].client->DidFail(clients_[i].id); |
759 } | 759 } |
760 } | 760 } |
761 break; | 761 break; |
762 } | 762 } |
763 } | 763 } |
764 } | 764 } |
765 | 765 |
766 bool WebPluginImpl::CheckIfRunInsecureContent(const GURL& url) { | |
767 if (!webframe_) | |
768 return true; | |
769 | |
770 return webframe_->checkIfRunInsecureContent(url); | |
771 } | |
772 | |
773 #if defined(OS_MACOSX) | 766 #if defined(OS_MACOSX) |
774 WebPluginAcceleratedSurface* WebPluginImpl::GetAcceleratedSurface( | 767 WebPluginAcceleratedSurface* WebPluginImpl::GetAcceleratedSurface( |
775 gfx::GpuPreference gpu_preference) { | 768 gfx::GpuPreference gpu_preference) { |
776 return NULL; | 769 return NULL; |
777 } | 770 } |
778 | 771 |
779 void WebPluginImpl::AcceleratedPluginEnabledRendering() { | 772 void WebPluginImpl::AcceleratedPluginEnabledRendering() { |
780 } | 773 } |
781 | 774 |
782 void WebPluginImpl::AcceleratedPluginAllocatedIOSurface(int32_t width, | 775 void WebPluginImpl::AcceleratedPluginAllocatedIOSurface(int32_t width, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 return 0; | 844 return 0; |
852 } | 845 } |
853 | 846 |
854 void WebPluginImpl::willFollowRedirect(WebURLLoader* loader, | 847 void WebPluginImpl::willFollowRedirect(WebURLLoader* loader, |
855 WebURLRequest& new_request, | 848 WebURLRequest& new_request, |
856 const WebURLResponse& response) { | 849 const WebURLResponse& response) { |
857 // TODO(jam): THIS LOGIC IS COPIED IN PluginURLFetcher::OnReceivedRedirect | 850 // TODO(jam): THIS LOGIC IS COPIED IN PluginURLFetcher::OnReceivedRedirect |
858 // until kDirectNPAPIRequests is the default and we can remove this old path. | 851 // until kDirectNPAPIRequests is the default and we can remove this old path. |
859 WebPluginImpl::ClientInfo* client_info = GetClientInfoFromLoader(loader); | 852 WebPluginImpl::ClientInfo* client_info = GetClientInfoFromLoader(loader); |
860 if (client_info) { | 853 if (client_info) { |
861 // Currently this check is just to catch an https -> http redirect when | |
862 // loading the main plugin src URL. Longer term, we could investigate | |
863 // firing mixed diplay or scripting issues for subresource loads | |
864 // initiated by plugins. | |
865 if (client_info->is_plugin_src_load && | |
866 webframe_ && | |
867 !webframe_->checkIfRunInsecureContent(new_request.url())) { | |
868 loader->cancel(); | |
869 client_info->client->DidFail(client_info->id); | |
870 return; | |
871 } | |
872 if (net::HttpResponseHeaders::IsRedirectResponseCode( | 854 if (net::HttpResponseHeaders::IsRedirectResponseCode( |
873 response.httpStatusCode())) { | 855 response.httpStatusCode())) { |
874 // If the plugin does not participate in url redirect notifications then | 856 // If the plugin does not participate in url redirect notifications then |
875 // just block cross origin 307 POST redirects. | 857 // just block cross origin 307 POST redirects. |
876 if (!client_info->notify_redirects) { | 858 if (!client_info->notify_redirects) { |
877 if (response.httpStatusCode() == 307 && | 859 if (response.httpStatusCode() == 307 && |
878 base::LowerCaseEqualsASCII( | 860 base::LowerCaseEqualsASCII( |
879 new_request.httpMethod().utf8(), "post")) { | 861 new_request.httpMethod().utf8(), "post")) { |
880 GURL original_request_url(response.url()); | 862 GURL original_request_url(response.url()); |
881 GURL response_url(new_request.url()); | 863 GURL response_url(new_request.url()); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 case PLUGIN_SRC: | 1201 case PLUGIN_SRC: |
1220 webframe_->setReferrerForRequest(*request, plugin_url_); | 1202 webframe_->setReferrerForRequest(*request, plugin_url_); |
1221 break; | 1203 break; |
1222 | 1204 |
1223 default: | 1205 default: |
1224 break; | 1206 break; |
1225 } | 1207 } |
1226 } | 1208 } |
1227 | 1209 |
1228 } // namespace content | 1210 } // namespace content |
OLD | NEW |