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

Side by Side Diff: net/http/http_security_headers.cc

Issue 12087091: Move string tokenizer to base/strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort Created 7 years, 10 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 | « net/http/http_content_disposition.cc ('k') | net/http/http_util.h » ('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 "base/base64.h" 5 #include "base/base64.h"
6 #include "base/basictypes.h" 6 #include "base/basictypes.h"
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/string_tokenizer.h"
9 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/strings/string_tokenizer.h"
10 #include "net/http/http_security_headers.h" 10 #include "net/http/http_security_headers.h"
11 #include "net/http/http_util.h" 11 #include "net/http/http_util.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 namespace { 15 namespace {
16 16
17 COMPILE_ASSERT(kMaxHSTSAgeSecs <= kuint32max, kMaxHSTSAgeSecsTooLarge); 17 COMPILE_ASSERT(kMaxHSTSAgeSecs <= kuint32max, kMaxHSTSAgeSecsTooLarge);
18 18
19 // MaxAgeToInt converts a string representation of a "whole number" of 19 // MaxAgeToInt converts a string representation of a "whole number" of
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 enum ParserState { 178 enum ParserState {
179 START, 179 START,
180 AFTER_MAX_AGE_LABEL, 180 AFTER_MAX_AGE_LABEL,
181 AFTER_MAX_AGE_EQUALS, 181 AFTER_MAX_AGE_EQUALS,
182 AFTER_MAX_AGE, 182 AFTER_MAX_AGE,
183 AFTER_INCLUDE_SUBDOMAINS, 183 AFTER_INCLUDE_SUBDOMAINS,
184 AFTER_UNKNOWN_LABEL, 184 AFTER_UNKNOWN_LABEL,
185 DIRECTIVE_END 185 DIRECTIVE_END
186 } state = START; 186 } state = START;
187 187
188 StringTokenizer tokenizer(value, " \t=;"); 188 base::StringTokenizer tokenizer(value, " \t=;");
189 tokenizer.set_options(StringTokenizer::RETURN_DELIMS); 189 tokenizer.set_options(base::StringTokenizer::RETURN_DELIMS);
190 tokenizer.set_quote_chars("\""); 190 tokenizer.set_quote_chars("\"");
191 std::string unquoted; 191 std::string unquoted;
192 while (tokenizer.GetNext()) { 192 while (tokenizer.GetNext()) {
193 DCHECK(!tokenizer.token_is_delim() || tokenizer.token().length() == 1); 193 DCHECK(!tokenizer.token_is_delim() || tokenizer.token().length() == 1);
194 switch (state) { 194 switch (state) {
195 case START: 195 case START:
196 case DIRECTIVE_END: 196 case DIRECTIVE_END:
197 if (IsAsciiWhitespace(*tokenizer.token_begin())) 197 if (IsAsciiWhitespace(*tokenizer.token_begin()))
198 continue; 198 continue;
199 if (LowerCaseEqualsASCII(tokenizer.token(), "max-age")) { 199 if (LowerCaseEqualsASCII(tokenizer.token(), "max-age")) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 *expiry = now + base::TimeDelta::FromSeconds(max_age_candidate); 321 *expiry = now + base::TimeDelta::FromSeconds(max_age_candidate);
322 for (HashValueVector::const_iterator i = pins.begin(); 322 for (HashValueVector::const_iterator i = pins.begin();
323 i != pins.end(); ++i) { 323 i != pins.end(); ++i) {
324 hashes->push_back(*i); 324 hashes->push_back(*i);
325 } 325 }
326 326
327 return true; 327 return true;
328 } 328 }
329 329
330 } // namespace net 330 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_content_disposition.cc ('k') | net/http/http_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698