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

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

Issue 10701119: PPAPI: Set custom user agent in headers, if applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « 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) 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 !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 } 121 }
122 122
123 if (data().has_custom_user_agent) {
124 // TODO(viettrungluu): If |custom_user_agent| is empty, we're supposed to
125 // arrange for User-Agent to be omitted; this probably won't do that.
126 dest->addHTTPHeaderField(WebString::fromUTF8("User-Agent"),
127 WebString::fromUTF8(data().custom_user_agent));
128 }
129
123 return true; 130 return true;
124 } 131 }
125 132
126 bool PPB_URLRequestInfo_Impl::RequiresUniversalAccess() const { 133 bool PPB_URLRequestInfo_Impl::RequiresUniversalAccess() const {
127 return 134 return
128 data().has_custom_referrer_url || 135 data().has_custom_referrer_url ||
129 data().has_custom_content_transfer_encoding || 136 data().has_custom_content_transfer_encoding ||
130 data().has_custom_user_agent || 137 data().has_custom_user_agent ||
131 url_util::FindAndCompareScheme(data().url, "javascript", NULL); 138 url_util::FindAndCompareScheme(data().url, "javascript", NULL);
132 } 139 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 webkit_glue::FilePathToWebString(platform_path), 199 webkit_glue::FilePathToWebString(platform_path),
193 start_offset, 200 start_offset,
194 number_of_bytes, 201 number_of_bytes,
195 expected_last_modified_time); 202 expected_last_modified_time);
196 return true; 203 return true;
197 } 204 }
198 205
199 206
200 } // namespace ppapi 207 } // namespace ppapi
201 } // namespace webkit 208 } // namespace webkit
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