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/logging.h" | 10 #include "base/logging.h" |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 response_info.expected_length, | 1040 response_info.expected_length, |
1041 response_info.last_modified, | 1041 response_info.last_modified, |
1042 request_is_seekable); | 1042 request_is_seekable); |
1043 | 1043 |
1044 // Bug http://b/issue?id=925559. The flash plugin would not handle the HTTP | 1044 // Bug http://b/issue?id=925559. The flash plugin would not handle the HTTP |
1045 // error codes in the stream header and as a result, was unaware of the | 1045 // error codes in the stream header and as a result, was unaware of the |
1046 // fate of the HTTP requests issued via NPN_GetURLNotify. Webkit and FF | 1046 // fate of the HTTP requests issued via NPN_GetURLNotify. Webkit and FF |
1047 // destroy the stream and invoke the NPP_DestroyStream function on the | 1047 // destroy the stream and invoke the NPP_DestroyStream function on the |
1048 // plugin if the HTTP request fails. | 1048 // plugin if the HTTP request fails. |
1049 const GURL& url = response.url(); | 1049 const GURL& url = response.url(); |
1050 if (url.SchemeIs("http") || url.SchemeIs("https")) { | 1050 if (url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme)) { |
1051 if (response.httpStatusCode() < 100 || response.httpStatusCode() >= 400) { | 1051 if (response.httpStatusCode() < 100 || response.httpStatusCode() >= 400) { |
1052 // The plugin instance could be in the process of deletion here. | 1052 // The plugin instance could be in the process of deletion here. |
1053 // Verify if the WebPluginResourceClient instance still exists before | 1053 // Verify if the WebPluginResourceClient instance still exists before |
1054 // use. | 1054 // use. |
1055 ClientInfo* client_info = GetClientInfoFromLoader(loader); | 1055 ClientInfo* client_info = GetClientInfoFromLoader(loader); |
1056 if (client_info) { | 1056 if (client_info) { |
1057 client_info->pending_failure_notification = true; | 1057 client_info->pending_failure_notification = true; |
1058 } | 1058 } |
1059 } | 1059 } |
1060 } | 1060 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 bool notify_redirects, | 1163 bool notify_redirects, |
1164 bool is_plugin_src_load) { | 1164 bool is_plugin_src_load) { |
1165 // For this request, we either route the output to a frame | 1165 // For this request, we either route the output to a frame |
1166 // because a target has been specified, or we handle the request | 1166 // because a target has been specified, or we handle the request |
1167 // here, i.e. by executing the script if it is a javascript url | 1167 // here, i.e. by executing the script if it is a javascript url |
1168 // or by initiating a download on the URL, etc. There is one special | 1168 // or by initiating a download on the URL, etc. There is one special |
1169 // case in that the request is a javascript url and the target is "_self", | 1169 // case in that the request is a javascript url and the target is "_self", |
1170 // in which case we route the output to the plugin rather than routing it | 1170 // in which case we route the output to the plugin rather than routing it |
1171 // to the plugin's frame. | 1171 // to the plugin's frame. |
1172 bool is_javascript_url = | 1172 bool is_javascript_url = |
1173 url::FindAndCompareScheme(url, strlen(url), "javascript", NULL); | 1173 url::FindAndCompareScheme(url, strlen(url), url::kJavaScriptScheme, NULL); |
1174 RoutingStatus routing_status = RouteToFrame( | 1174 RoutingStatus routing_status = RouteToFrame( |
1175 url, is_javascript_url, popups_allowed, method, target, buf, len, | 1175 url, is_javascript_url, popups_allowed, method, target, buf, len, |
1176 notify_id, referrer_flag); | 1176 notify_id, referrer_flag); |
1177 if (routing_status == ROUTED) | 1177 if (routing_status == ROUTED) |
1178 return; | 1178 return; |
1179 | 1179 |
1180 if (is_javascript_url) { | 1180 if (is_javascript_url) { |
1181 GURL gurl(url); | 1181 GURL gurl(url); |
1182 WebString result = container_->executeScriptURL(gurl, popups_allowed); | 1182 WebString result = container_->executeScriptURL(gurl, popups_allowed); |
1183 | 1183 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 case PLUGIN_SRC: | 1525 case PLUGIN_SRC: |
1526 webframe_->setReferrerForRequest(*request, plugin_url_); | 1526 webframe_->setReferrerForRequest(*request, plugin_url_); |
1527 break; | 1527 break; |
1528 | 1528 |
1529 default: | 1529 default: |
1530 break; | 1530 break; |
1531 } | 1531 } |
1532 } | 1532 } |
1533 | 1533 |
1534 } // namespace content | 1534 } // namespace content |
OLD | NEW |