Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: webkit/plugins/npapi/webplugin_impl.cc

Issue 6392042: Propagate the user gesture state. It is necessary to do correct pop-up blocki... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/npapi/webplugin_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "webkit/plugins/npapi/webplugin_impl.h" 5 #include "webkit/plugins/npapi/webplugin_impl.h"
6 6
7 #include "base/linked_ptr.h" 7 #include "base/linked_ptr.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 string_to_search.find("\\") != std::string::npos) 652 string_to_search.find("\\") != std::string::npos)
653 return false; 653 return false;
654 } 654 }
655 655
656 return true; 656 return true;
657 } 657 }
658 658
659 WebPluginImpl::RoutingStatus WebPluginImpl::RouteToFrame( 659 WebPluginImpl::RoutingStatus WebPluginImpl::RouteToFrame(
660 const char* url, 660 const char* url,
661 bool is_javascript_url, 661 bool is_javascript_url,
662 bool popups_allowed,
662 const char* method, 663 const char* method,
663 const char* target, 664 const char* target,
664 const char* buf, 665 const char* buf,
665 unsigned int len, 666 unsigned int len,
666 int notify_id, 667 int notify_id,
667 Referrer referrer_flag) { 668 Referrer referrer_flag) {
668 // If there is no target, there is nothing to do 669 // If there is no target, there is nothing to do
669 if (!target) 670 if (!target)
670 return NOT_ROUTED; 671 return NOT_ROUTED;
671 672
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 if (!(complete_url.SchemeIs("http") || complete_url.SchemeIs("https"))) 709 if (!(complete_url.SchemeIs("http") || complete_url.SchemeIs("https")))
709 return INVALID_URL; 710 return INVALID_URL;
710 } 711 }
711 712
712 WebURLRequest request(complete_url); 713 WebURLRequest request(complete_url);
713 SetReferrer(&request, referrer_flag); 714 SetReferrer(&request, referrer_flag);
714 715
715 request.setHTTPMethod(WebString::fromUTF8(method)); 716 request.setHTTPMethod(WebString::fromUTF8(method));
716 request.setFirstPartyForCookies( 717 request.setFirstPartyForCookies(
717 webframe_->document().firstPartyForCookies()); 718 webframe_->document().firstPartyForCookies());
719 request.setHasUserGesture(popups_allowed);
718 if (len > 0) { 720 if (len > 0) {
719 if (!SetPostData(&request, buf, len)) { 721 if (!SetPostData(&request, buf, len)) {
720 // Uhoh - we're in trouble. There isn't a good way 722 // Uhoh - we're in trouble. There isn't a good way
721 // to recover at this point. Break out. 723 // to recover at this point. Break out.
722 NOTREACHED(); 724 NOTREACHED();
723 return ROUTED; 725 return ROUTED;
724 } 726 }
725 } 727 }
726 728
727 container_->loadFrameRequest( 729 container_->loadFrameRequest(
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 bool notify_redirects) { 1073 bool notify_redirects) {
1072 // For this request, we either route the output to a frame 1074 // For this request, we either route the output to a frame
1073 // because a target has been specified, or we handle the request 1075 // because a target has been specified, or we handle the request
1074 // here, i.e. by executing the script if it is a javascript url 1076 // here, i.e. by executing the script if it is a javascript url
1075 // or by initiating a download on the URL, etc. There is one special 1077 // or by initiating a download on the URL, etc. There is one special
1076 // case in that the request is a javascript url and the target is "_self", 1078 // case in that the request is a javascript url and the target is "_self",
1077 // in which case we route the output to the plugin rather than routing it 1079 // in which case we route the output to the plugin rather than routing it
1078 // to the plugin's frame. 1080 // to the plugin's frame.
1079 bool is_javascript_url = StartsWithASCII(url, "javascript:", false); 1081 bool is_javascript_url = StartsWithASCII(url, "javascript:", false);
1080 RoutingStatus routing_status = RouteToFrame( 1082 RoutingStatus routing_status = RouteToFrame(
1081 url, is_javascript_url, method, target, buf, len, notify_id, 1083 url, is_javascript_url, popups_allowed, method, target, buf, len,
1082 referrer_flag); 1084 notify_id, referrer_flag);
1083 if (routing_status == ROUTED) 1085 if (routing_status == ROUTED)
1084 return; 1086 return;
1085 1087
1086 if (is_javascript_url) { 1088 if (is_javascript_url) {
1087 GURL gurl(url); 1089 GURL gurl(url);
1088 WebString result = container_->executeScriptURL(gurl, popups_allowed); 1090 WebString result = container_->executeScriptURL(gurl, popups_allowed);
1089 1091
1090 // delegate_ could be NULL because executeScript caused the container to 1092 // delegate_ could be NULL because executeScript caused the container to
1091 // be deleted. 1093 // be deleted.
1092 if (delegate_) { 1094 if (delegate_) {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 if (!webframe_) 1380 if (!webframe_)
1379 return NULL; 1381 return NULL;
1380 WebView* view = webframe_->view(); 1382 WebView* view = webframe_->view();
1381 if (!view) 1383 if (!view)
1382 return NULL; 1384 return NULL;
1383 return view->devToolsAgent(); 1385 return view->devToolsAgent();
1384 } 1386 }
1385 1387
1386 } // namespace npapi 1388 } // namespace npapi
1387 } // namespace webkit 1389 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/webplugin_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698