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

Side by Side Diff: webkit/plugins/ppapi/ppb_url_request_info_impl.cc

Issue 10780019: PPAPI (Flash): Properly honor Pepper url requests with custom user agents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: got rid of unneeded WebKit:: Created 8 years, 5 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/glue/weburlrequest_extradata_impl.cc ('k') | webkit/support/webkit_support.cc » ('j') | 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) 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 "webkit/plugins/ppapi/ppb_url_request_info_impl.h" 5 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 #include "googleurl/src/url_util.h" 10 #include "googleurl/src/url_util.h"
11 #include "net/http/http_util.h" 11 #include "net/http/http_util.h"
12 #include "ppapi/shared_impl/var.h" 12 #include "ppapi/shared_impl/var.h"
13 #include "ppapi/thunk/enter.h" 13 #include "ppapi/thunk/enter.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody. h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody. h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h"
20 #include "webkit/glue/webkit_glue.h" 20 #include "webkit/glue/webkit_glue.h"
21 #include "webkit/glue/weburlrequest_extradata_impl.h"
21 #include "webkit/plugins/ppapi/common.h" 22 #include "webkit/plugins/ppapi/common.h"
22 #include "webkit/plugins/ppapi/plugin_module.h" 23 #include "webkit/plugins/ppapi/plugin_module.h"
23 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" 24 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
24 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" 25 #include "webkit/plugins/ppapi/ppb_file_system_impl.h"
25 #include "webkit/plugins/ppapi/resource_helper.h" 26 #include "webkit/plugins/ppapi/resource_helper.h"
26 27
27 using ppapi::PPB_URLRequestInfo_Data; 28 using ppapi::PPB_URLRequestInfo_Data;
28 using ppapi::Resource; 29 using ppapi::Resource;
29 using ppapi::thunk::EnterResourceNoLock; 30 using ppapi::thunk::EnterResourceNoLock;
30 using ppapi::thunk::PPB_FileRef_API; 31 using ppapi::thunk::PPB_FileRef_API;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 115 }
115 116
116 if (data().has_custom_content_transfer_encoding && 117 if (data().has_custom_content_transfer_encoding &&
117 !data().custom_content_transfer_encoding.empty()) { 118 !data().custom_content_transfer_encoding.empty()) {
118 dest->addHTTPHeaderField( 119 dest->addHTTPHeaderField(
119 WebString::fromUTF8("Content-Transfer-Encoding"), 120 WebString::fromUTF8("Content-Transfer-Encoding"),
120 WebString::fromUTF8(data().custom_content_transfer_encoding)); 121 WebString::fromUTF8(data().custom_content_transfer_encoding));
121 } 122 }
122 123
123 if (data().has_custom_user_agent) { 124 if (data().has_custom_user_agent) {
124 // TODO(viettrungluu): If |custom_user_agent| is empty, we're supposed to 125 dest->setExtraData(new webkit_glue::WebURLRequestExtraDataImpl(
125 // arrange for User-Agent to be omitted; this probably won't do that. 126 WebKit::WebReferrerPolicyDefault, // Ignored.
126 dest->addHTTPHeaderField(WebString::fromUTF8("User-Agent"), 127 WebString::fromUTF8(data().custom_user_agent)));
127 WebString::fromUTF8(data().custom_user_agent));
128 } 128 }
129 129
130 return true; 130 return true;
131 } 131 }
132 132
133 bool PPB_URLRequestInfo_Impl::RequiresUniversalAccess() const { 133 bool PPB_URLRequestInfo_Impl::RequiresUniversalAccess() const {
134 return 134 return
135 data().has_custom_referrer_url || 135 data().has_custom_referrer_url ||
136 data().has_custom_content_transfer_encoding || 136 data().has_custom_content_transfer_encoding ||
137 data().has_custom_user_agent || 137 data().has_custom_user_agent ||
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 webkit_glue::FilePathToWebString(platform_path), 199 webkit_glue::FilePathToWebString(platform_path),
200 start_offset, 200 start_offset,
201 number_of_bytes, 201 number_of_bytes,
202 expected_last_modified_time); 202 expected_last_modified_time);
203 return true; 203 return true;
204 } 204 }
205 205
206 206
207 } // namespace ppapi 207 } // namespace ppapi
208 } // namespace webkit 208 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/glue/weburlrequest_extradata_impl.cc ('k') | webkit/support/webkit_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698