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

Side by Side Diff: content/renderer/pepper/url_request_info_util.cc

Issue 1878083002: Implement IsAsciiUpper and IsAsciiLower in base/strings/string_util.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git sync Created 4 years, 8 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
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 "content/renderer/pepper/url_request_info_util.h" 5 #include "content/renderer/pepper/url_request_info_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return true; 106 return true;
107 } 107 }
108 108
109 std::string FilterStringForXRequestedWithValue(const std::string& s) { 109 std::string FilterStringForXRequestedWithValue(const std::string& s) {
110 std::string rv; 110 std::string rv;
111 rv.reserve(s.length()); 111 rv.reserve(s.length());
112 for (size_t i = 0; i < s.length(); i++) { 112 for (size_t i = 0; i < s.length(); i++) {
113 char c = s[i]; 113 char c = s[i];
114 // Allow ASCII digits, letters, periods, commas, and underscores. (Ignore 114 // Allow ASCII digits, letters, periods, commas, and underscores. (Ignore
115 // all other characters.) 115 // all other characters.)
116 if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || 116 if (base::IsAsciiDigit(c) || base::IsAsciiAlpha(c) || (c == '.') ||
117 (c >= 'a' && c <= 'z') || (c == '.') || (c == ',') || (c == '_')) 117 (c == ',') || (c == '_'))
118 rv.push_back(c); 118 rv.push_back(c);
119 } 119 }
120 return rv; 120 return rv;
121 } 121 }
122 122
123 // Returns an appropriate value for the X-Requested-With header for plugins that 123 // Returns an appropriate value for the X-Requested-With header for plugins that
124 // present an X-Requested-With header. Returns a blank string for other plugins. 124 // present an X-Requested-With header. Returns a blank string for other plugins.
125 // We produce a user-agent-like string (eating spaces and other undesired 125 // We produce a user-agent-like string (eating spaces and other undesired
126 // characters) like "ShockwaveFlash/11.5.31.135" from the plugin name and 126 // characters) like "ShockwaveFlash/11.5.31.135" from the plugin name and
127 // version. 127 // version.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 242
243 bool URLRequestRequiresUniversalAccess(const URLRequestInfoData& data) { 243 bool URLRequestRequiresUniversalAccess(const URLRequestInfoData& data) {
244 return data.has_custom_referrer_url || 244 return data.has_custom_referrer_url ||
245 data.has_custom_content_transfer_encoding || 245 data.has_custom_content_transfer_encoding ||
246 data.has_custom_user_agent || 246 data.has_custom_user_agent ||
247 url::FindAndCompareScheme(data.url, url::kJavaScriptScheme, NULL); 247 url::FindAndCompareScheme(data.url, url::kJavaScriptScheme, NULL);
248 } 248 }
249 249
250 } // namespace content 250 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698