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

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

Issue 10762017: PPAPI: Add an API for setting a custom user agent for URL requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: foo 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 | « ppapi/tests/test_url_request.cc ('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) 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"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 dest->setHTTPBody(http_body); 106 dest->setHTTPBody(http_body);
107 } 107 }
108 108
109 // Add the "Referer" header if there is a custom referrer. Such requests 109 // Add the "Referer" header if there is a custom referrer. Such requests
110 // require universal access. For all other requests, "Referer" will be set 110 // require universal access. For all other requests, "Referer" will be set
111 // after header security checks are done in AssociatedURLLoader. 111 // after header security checks are done in AssociatedURLLoader.
112 if (data().has_custom_referrer_url && !data().custom_referrer_url.empty()) { 112 if (data().has_custom_referrer_url && !data().custom_referrer_url.empty()) {
113 frame->setReferrerForRequest(*dest, GURL(data().custom_referrer_url)); 113 frame->setReferrerForRequest(*dest, GURL(data().custom_referrer_url));
114 } 114 }
115 115
116 if (data().has_custom_content_transfer_encoding) { 116 if (data().has_custom_content_transfer_encoding &&
117 if (!data().custom_content_transfer_encoding.empty()) { 117 !data().custom_content_transfer_encoding.empty()) {
118 dest->addHTTPHeaderField( 118 dest->addHTTPHeaderField(
119 WebString::fromUTF8("Content-Transfer-Encoding"), 119 WebString::fromUTF8("Content-Transfer-Encoding"),
120 WebString::fromUTF8(data().custom_content_transfer_encoding)); 120 WebString::fromUTF8(data().custom_content_transfer_encoding));
121 }
122 } 121 }
123 122
124 return true; 123 return true;
125 } 124 }
126 125
127 bool PPB_URLRequestInfo_Impl::RequiresUniversalAccess() const { 126 bool PPB_URLRequestInfo_Impl::RequiresUniversalAccess() const {
128 return 127 return
129 data().has_custom_referrer_url || 128 data().has_custom_referrer_url ||
130 data().has_custom_content_transfer_encoding || 129 data().has_custom_content_transfer_encoding ||
130 data().has_custom_user_agent ||
131 url_util::FindAndCompareScheme(data().url, "javascript", NULL); 131 url_util::FindAndCompareScheme(data().url, "javascript", NULL);
132 } 132 }
133 133
134 bool PPB_URLRequestInfo_Impl::ValidateData() { 134 bool PPB_URLRequestInfo_Impl::ValidateData() {
135 if (data().prefetch_buffer_lower_threshold < 0 || 135 if (data().prefetch_buffer_lower_threshold < 0 ||
136 data().prefetch_buffer_upper_threshold < 0 || 136 data().prefetch_buffer_upper_threshold < 0 ||
137 data().prefetch_buffer_upper_threshold <= 137 data().prefetch_buffer_upper_threshold <=
138 data().prefetch_buffer_lower_threshold) { 138 data().prefetch_buffer_lower_threshold) {
139 return false; 139 return false;
140 } 140 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 webkit_glue::FilePathToWebString(platform_path), 192 webkit_glue::FilePathToWebString(platform_path),
193 start_offset, 193 start_offset,
194 number_of_bytes, 194 number_of_bytes,
195 expected_last_modified_time); 195 expected_last_modified_time);
196 return true; 196 return true;
197 } 197 }
198 198
199 199
200 } // namespace ppapi 200 } // namespace ppapi
201 } // namespace webkit 201 } // namespace webkit
OLDNEW
« no previous file with comments | « ppapi/tests/test_url_request.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698