OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/child/npapi/plugin_url_fetcher.h" | 5 #include "content/child/npapi/plugin_url_fetcher.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "content/child/child_thread.h" | 8 #include "content/child/child_thread.h" |
9 #include "content/child/npapi/webplugin.h" | 9 #include "content/child/npapi/webplugin.h" |
10 #include "content/child/npapi/plugin_host.h" | 10 #include "content/child/npapi/plugin_host.h" |
11 #include "content/child/npapi/plugin_instance.h" | 11 #include "content/child/npapi/plugin_instance.h" |
12 #include "content/child/npapi/plugin_stream_url.h" | 12 #include "content/child/npapi/plugin_stream_url.h" |
13 #include "content/child/npapi/webplugin_resource_client.h" | 13 #include "content/child/npapi/webplugin_resource_client.h" |
14 #include "content/child/plugin_messages.h" | 14 #include "content/child/plugin_messages.h" |
| 15 #include "content/child/request_extra_data.h" |
15 #include "content/child/resource_dispatcher.h" | 16 #include "content/child/resource_dispatcher.h" |
16 #include "net/base/load_flags.h" | 17 #include "net/base/load_flags.h" |
17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
18 #include "net/http/http_response_headers.h" | 19 #include "net/http/http_response_headers.h" |
19 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 20 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
20 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 21 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
21 #include "webkit/child/multipart_response_delegate.h" | 22 #include "webkit/child/multipart_response_delegate.h" |
22 #include "webkit/child/weburlloader_impl.h" | 23 #include "webkit/child/weburlloader_impl.h" |
23 #include "webkit/common/resource_request_body.h" | 24 #include "webkit/common/resource_request_body.h" |
24 | 25 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 const GURL& url, | 75 const GURL& url, |
75 const GURL& first_party_for_cookies, | 76 const GURL& first_party_for_cookies, |
76 const std::string& method, | 77 const std::string& method, |
77 const char* buf, | 78 const char* buf, |
78 unsigned int len, | 79 unsigned int len, |
79 const GURL& referrer, | 80 const GURL& referrer, |
80 bool notify_redirects, | 81 bool notify_redirects, |
81 bool is_plugin_src_load, | 82 bool is_plugin_src_load, |
82 int origin_pid, | 83 int origin_pid, |
83 int render_frame_id, | 84 int render_frame_id, |
| 85 int render_view_id, |
84 unsigned long resource_id, | 86 unsigned long resource_id, |
85 bool copy_stream_data) | 87 bool copy_stream_data) |
86 : plugin_stream_(plugin_stream), | 88 : plugin_stream_(plugin_stream), |
87 url_(url), | 89 url_(url), |
88 first_party_for_cookies_(first_party_for_cookies), | 90 first_party_for_cookies_(first_party_for_cookies), |
89 method_(method), | 91 method_(method), |
90 referrer_(referrer), | 92 referrer_(referrer), |
91 notify_redirects_(notify_redirects), | 93 notify_redirects_(notify_redirects), |
92 is_plugin_src_load_(is_plugin_src_load), | 94 is_plugin_src_load_(is_plugin_src_load), |
93 resource_id_(resource_id), | 95 resource_id_(resource_id), |
94 copy_stream_data_(copy_stream_data), | 96 copy_stream_data_(copy_stream_data), |
95 data_offset_(0), | 97 data_offset_(0), |
96 pending_failure_notification_(false) { | 98 pending_failure_notification_(false) { |
97 webkit_glue::ResourceLoaderBridge::RequestInfo request_info; | 99 webkit_glue::ResourceLoaderBridge::RequestInfo request_info; |
98 request_info.method = method; | 100 request_info.method = method; |
99 request_info.url = url; | 101 request_info.url = url; |
100 request_info.first_party_for_cookies = first_party_for_cookies; | 102 request_info.first_party_for_cookies = first_party_for_cookies; |
101 request_info.referrer = referrer; | 103 request_info.referrer = referrer; |
102 request_info.load_flags = net::LOAD_NORMAL; | 104 request_info.load_flags = net::LOAD_NORMAL; |
103 request_info.requestor_pid = origin_pid; | 105 request_info.requestor_pid = origin_pid; |
104 request_info.request_type = ResourceType::OBJECT; | 106 request_info.request_type = ResourceType::OBJECT; |
105 request_info.routing_id = render_frame_id; | 107 request_info.routing_id = render_view_id; |
| 108 |
| 109 RequestExtraData extra_data(blink::WebReferrerPolicyDefault, |
| 110 base::string16(), |
| 111 false, |
| 112 render_frame_id, |
| 113 false, |
| 114 -1, |
| 115 GURL(), |
| 116 false, |
| 117 -1, |
| 118 true, |
| 119 PAGE_TRANSITION_LINK, |
| 120 false, |
| 121 -1, |
| 122 -1); |
| 123 |
| 124 request_info.extra_data = &extra_data; |
106 | 125 |
107 std::vector<char> body; | 126 std::vector<char> body; |
108 if (method == "POST") { | 127 if (method == "POST") { |
109 bool content_type_found = false; | 128 bool content_type_found = false; |
110 std::vector<std::string> names; | 129 std::vector<std::string> names; |
111 std::vector<std::string> values; | 130 std::vector<std::string> values; |
112 PluginHost::SetPostData(buf, len, &names, &values, &body); | 131 PluginHost::SetPostData(buf, len, &names, &values, &body); |
113 for (size_t i = 0; i < names.size(); ++i) { | 132 for (size_t i = 0; i < names.size(); ++i) { |
114 if (!request_info.headers.empty()) | 133 if (!request_info.headers.empty()) |
115 request_info.headers += "\r\n"; | 134 request_info.headers += "\r\n"; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 349 } |
331 | 350 |
332 if (error_code == net::OK) { | 351 if (error_code == net::OK) { |
333 plugin_stream_->DidFinishLoading(resource_id_); | 352 plugin_stream_->DidFinishLoading(resource_id_); |
334 } else { | 353 } else { |
335 plugin_stream_->DidFail(resource_id_); | 354 plugin_stream_->DidFail(resource_id_); |
336 } | 355 } |
337 } | 356 } |
338 | 357 |
339 } // namespace content | 358 } // namespace content |
OLD | NEW |