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

Side by Side Diff: webkit/glue/webplugin_impl.cc

Issue 601038: Specify the first-party-for-cookies URL for HTTP requests... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add TODO comments about WebDocument::firstPartyForCookies. Created 10 years, 9 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 | « no previous file | 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "base/gfx/rect.h" 5 #include "base/gfx/rect.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "net/base/escape.h" 10 #include "net/base/escape.h"
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 if (strcmp(method, "GET") != 0) { 550 if (strcmp(method, "GET") != 0) {
551 // We're only going to route HTTP/HTTPS requests 551 // We're only going to route HTTP/HTTPS requests
552 if (!(complete_url.SchemeIs("http") || complete_url.SchemeIs("https"))) 552 if (!(complete_url.SchemeIs("http") || complete_url.SchemeIs("https")))
553 return INVALID_URL; 553 return INVALID_URL;
554 } 554 }
555 555
556 WebURLRequest request(complete_url); 556 WebURLRequest request(complete_url);
557 SetReferrer(&request, referrer_flag); 557 SetReferrer(&request, referrer_flag);
558 558
559 request.setHTTPMethod(WebString::fromUTF8(method)); 559 request.setHTTPMethod(WebString::fromUTF8(method));
560 // TODO(wtc): add a WebDocument::firstPartyForCookies method.
561 request.setFirstPartyForCookies(webframe_->top()->url());
560 if (len > 0) { 562 if (len > 0) {
561 if (!SetPostData(&request, buf, len)) { 563 if (!SetPostData(&request, buf, len)) {
562 // Uhoh - we're in trouble. There isn't a good way 564 // Uhoh - we're in trouble. There isn't a good way
563 // to recover at this point. Break out. 565 // to recover at this point. Break out.
564 NOTREACHED(); 566 NOTREACHED();
565 return ROUTED; 567 return ROUTED;
566 } 568 }
567 } 569 }
568 570
569 container_->loadFrameRequest( 571 container_->loadFrameRequest(
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 } 844 }
843 } 845 }
844 846
845 void WebPluginImpl::SetContainer(WebPluginContainer* container) { 847 void WebPluginImpl::SetContainer(WebPluginContainer* container) {
846 if (!container) 848 if (!container)
847 TearDownPluginInstance(NULL); 849 TearDownPluginInstance(NULL);
848 container_ = container; 850 container_ = container;
849 } 851 }
850 852
851 void WebPluginImpl::HandleURLRequest(const char* url, 853 void WebPluginImpl::HandleURLRequest(const char* url,
852 const char *method, 854 const char* method,
853 const char* target, 855 const char* target,
854 const char* buf, 856 const char* buf,
855 unsigned int len, 857 unsigned int len,
856 int notify_id, 858 int notify_id,
857 bool popups_allowed) { 859 bool popups_allowed) {
858 // GetURL/PostURL requests initiated explicitly by plugins should specify the 860 // GetURL/PostURL requests initiated explicitly by plugins should specify the
859 // plugin SRC url as the referrer if it is available. 861 // plugin SRC url as the referrer if it is available.
860 HandleURLRequestInternal( 862 HandleURLRequestInternal(
861 url, method, target, buf, len, notify_id, popups_allowed, PLUGIN_SRC); 863 url, method, target, buf, len, notify_id, popups_allowed, PLUGIN_SRC);
862 } 864 }
863 865
864 void WebPluginImpl::HandleURLRequestInternal(const char* url, 866 void WebPluginImpl::HandleURLRequestInternal(const char* url,
865 const char *method, 867 const char* method,
866 const char* target, 868 const char* target,
867 const char* buf, 869 const char* buf,
868 unsigned int len, 870 unsigned int len,
869 int notify_id, 871 int notify_id,
870 bool popups_allowed, 872 bool popups_allowed,
871 Referrer referrer_flag) { 873 Referrer referrer_flag) {
872 // For this request, we either route the output to a frame 874 // For this request, we either route the output to a frame
873 // because a target has been specified, or we handle the request 875 // because a target has been specified, or we handle the request
874 // here, i.e. by executing the script if it is a javascript url 876 // here, i.e. by executing the script if it is a javascript url
875 // or by initiating a download on the URL, etc. There is one special 877 // or by initiating a download on the URL, etc. There is one special
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 if (!client) { 947 if (!client) {
946 NOTREACHED(); 948 NOTREACHED();
947 return false; 949 return false;
948 } 950 }
949 951
950 ClientInfo info; 952 ClientInfo info;
951 info.id = resource_id; 953 info.id = resource_id;
952 info.client = client; 954 info.client = client;
953 info.request.initialize(); 955 info.request.initialize();
954 info.request.setURL(url); 956 info.request.setURL(url);
957 // TODO(wtc): add a WebDocument::firstPartyForCookies method.
958 info.request.setFirstPartyForCookies(webframe_->top()->url());
955 info.request.setRequestorProcessID(delegate_->GetProcessId()); 959 info.request.setRequestorProcessID(delegate_->GetProcessId());
956 info.request.setTargetType(WebURLRequest::TargetIsObject); 960 info.request.setTargetType(WebURLRequest::TargetIsObject);
957 info.request.setHTTPMethod(WebString::fromUTF8(method)); 961 info.request.setHTTPMethod(WebString::fromUTF8(method));
958 info.pending_failure_notification = false; 962 info.pending_failure_notification = false;
959 963
960 if (range_info) { 964 if (range_info) {
961 info.request.addHTTPHeaderField(WebString::fromUTF8("Range"), 965 info.request.addHTTPHeaderField(WebString::fromUTF8("Range"),
962 WebString::fromUTF8(range_info)); 966 WebString::fromUTF8(range_info));
963 } 967 }
964 968
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 WebDevToolsAgent* WebPluginImpl::GetDevToolsAgent() { 1169 WebDevToolsAgent* WebPluginImpl::GetDevToolsAgent() {
1166 if (!webframe_) 1170 if (!webframe_)
1167 return NULL; 1171 return NULL;
1168 WebView* view = webframe_->view(); 1172 WebView* view = webframe_->view();
1169 if (!view) 1173 if (!view)
1170 return NULL; 1174 return NULL;
1171 return view->devToolsAgent(); 1175 return view->devToolsAgent();
1172 } 1176 }
1173 1177
1174 } // namespace webkit_glue 1178 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698