| 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 return rv; | 651 return rv; |
| 652 } | 652 } |
| 653 | 653 |
| 654 bool WebPluginImpl::IsValidUrl(const GURL& url, Referrer referrer_flag) { | 654 bool WebPluginImpl::IsValidUrl(const GURL& url, Referrer referrer_flag) { |
| 655 if (referrer_flag == PLUGIN_SRC && | 655 if (referrer_flag == PLUGIN_SRC && |
| 656 mime_type_ == kFlashPluginSwfMimeType && | 656 mime_type_ == kFlashPluginSwfMimeType && |
| 657 url.GetOrigin() != plugin_url_.GetOrigin()) { | 657 url.GetOrigin() != plugin_url_.GetOrigin()) { |
| 658 // Do url check to make sure that there are no @, ;, \ chars in between url | 658 // Do url check to make sure that there are no @, ;, \ chars in between url |
| 659 // scheme and url path. | 659 // scheme and url path. |
| 660 const char* url_to_check(url.spec().data()); | 660 const char* url_to_check(url.spec().data()); |
| 661 url_parse::Parsed parsed; | 661 url::Parsed parsed; |
| 662 url_parse::ParseStandardURL(url_to_check, strlen(url_to_check), &parsed); | 662 url::ParseStandardURL(url_to_check, strlen(url_to_check), &parsed); |
| 663 if (parsed.path.begin <= parsed.scheme.end()) | 663 if (parsed.path.begin <= parsed.scheme.end()) |
| 664 return true; | 664 return true; |
| 665 std::string string_to_search; | 665 std::string string_to_search; |
| 666 string_to_search.assign(url_to_check + parsed.scheme.end(), | 666 string_to_search.assign(url_to_check + parsed.scheme.end(), |
| 667 parsed.path.begin - parsed.scheme.end()); | 667 parsed.path.begin - parsed.scheme.end()); |
| 668 if (string_to_search.find("@") != std::string::npos || | 668 if (string_to_search.find("@") != std::string::npos || |
| 669 string_to_search.find(";") != std::string::npos || | 669 string_to_search.find(";") != std::string::npos || |
| 670 string_to_search.find("\\") != std::string::npos) | 670 string_to_search.find("\\") != std::string::npos) |
| 671 return false; | 671 return false; |
| 672 } | 672 } |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 Referrer referrer_flag, | 1163 Referrer referrer_flag, |
| 1164 bool notify_redirects, | 1164 bool notify_redirects, |
| 1165 bool is_plugin_src_load) { | 1165 bool is_plugin_src_load) { |
| 1166 // For this request, we either route the output to a frame | 1166 // For this request, we either route the output to a frame |
| 1167 // because a target has been specified, or we handle the request | 1167 // because a target has been specified, or we handle the request |
| 1168 // here, i.e. by executing the script if it is a javascript url | 1168 // here, i.e. by executing the script if it is a javascript url |
| 1169 // or by initiating a download on the URL, etc. There is one special | 1169 // or by initiating a download on the URL, etc. There is one special |
| 1170 // case in that the request is a javascript url and the target is "_self", | 1170 // case in that the request is a javascript url and the target is "_self", |
| 1171 // in which case we route the output to the plugin rather than routing it | 1171 // in which case we route the output to the plugin rather than routing it |
| 1172 // to the plugin's frame. | 1172 // to the plugin's frame. |
| 1173 bool is_javascript_url = url_util::FindAndCompareScheme( | 1173 bool is_javascript_url = |
| 1174 url, strlen(url), "javascript", NULL); | 1174 url::FindAndCompareScheme(url, strlen(url), "javascript", NULL); |
| 1175 RoutingStatus routing_status = RouteToFrame( | 1175 RoutingStatus routing_status = RouteToFrame( |
| 1176 url, is_javascript_url, popups_allowed, method, target, buf, len, | 1176 url, is_javascript_url, popups_allowed, method, target, buf, len, |
| 1177 notify_id, referrer_flag); | 1177 notify_id, referrer_flag); |
| 1178 if (routing_status == ROUTED) | 1178 if (routing_status == ROUTED) |
| 1179 return; | 1179 return; |
| 1180 | 1180 |
| 1181 if (is_javascript_url) { | 1181 if (is_javascript_url) { |
| 1182 GURL gurl(url); | 1182 GURL gurl(url); |
| 1183 WebString result = container_->executeScriptURL(gurl, popups_allowed); | 1183 WebString result = container_->executeScriptURL(gurl, popups_allowed); |
| 1184 | 1184 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 case PLUGIN_SRC: | 1523 case PLUGIN_SRC: |
| 1524 webframe_->setReferrerForRequest(*request, plugin_url_); | 1524 webframe_->setReferrerForRequest(*request, plugin_url_); |
| 1525 break; | 1525 break; |
| 1526 | 1526 |
| 1527 default: | 1527 default: |
| 1528 break; | 1528 break; |
| 1529 } | 1529 } |
| 1530 } | 1530 } |
| 1531 | 1531 |
| 1532 } // namespace content | 1532 } // namespace content |
| OLD | NEW |