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

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

Issue 1172753003: Move LowerCaseEqualsASCII to base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util
Patch Set: Created 5 years, 6 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
« no previous file with comments | « net/http/http_cache_transaction.cc ('k') | net/http/http_response_headers.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 "net/http/http_content_disposition.h" 5 #include "net/http/http_content_disposition.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_tokenizer.h" 9 #include "base/strings/string_tokenizer.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // If the disposition-type isn't a valid token the then the 352 // If the disposition-type isn't a valid token the then the
353 // Content-Disposition header is malformed, and we treat the first bytes as 353 // Content-Disposition header is malformed, and we treat the first bytes as
354 // a parameter rather than a disposition-type. 354 // a parameter rather than a disposition-type.
355 if (!HttpUtil::IsToken(type_begin, type_end)) 355 if (!HttpUtil::IsToken(type_begin, type_end))
356 return begin; 356 return begin;
357 357
358 parse_result_flags_ |= HAS_DISPOSITION_TYPE; 358 parse_result_flags_ |= HAS_DISPOSITION_TYPE;
359 359
360 DCHECK(std::find(type_begin, type_end, '=') == type_end); 360 DCHECK(std::find(type_begin, type_end, '=') == type_end);
361 361
362 if (LowerCaseEqualsASCII(type_begin, type_end, "inline")) { 362 if (base::LowerCaseEqualsASCII(type_begin, type_end, "inline")) {
363 type_ = INLINE; 363 type_ = INLINE;
364 } else if (LowerCaseEqualsASCII(type_begin, type_end, "attachment")) { 364 } else if (base::LowerCaseEqualsASCII(type_begin, type_end, "attachment")) {
365 type_ = ATTACHMENT; 365 type_ = ATTACHMENT;
366 } else { 366 } else {
367 parse_result_flags_ |= HAS_UNKNOWN_DISPOSITION_TYPE; 367 parse_result_flags_ |= HAS_UNKNOWN_DISPOSITION_TYPE;
368 type_ = ATTACHMENT; 368 type_ = ATTACHMENT;
369 } 369 }
370 return delimiter; 370 return delimiter;
371 } 371 }
372 372
373 // http://tools.ietf.org/html/rfc6266 373 // http://tools.ietf.org/html/rfc6266
374 // 374 //
(...skipping 20 matching lines...) Expand all
395 395
396 std::string::const_iterator pos = header.begin(); 396 std::string::const_iterator pos = header.begin();
397 std::string::const_iterator end = header.end(); 397 std::string::const_iterator end = header.end();
398 pos = ConsumeDispositionType(pos, end); 398 pos = ConsumeDispositionType(pos, end);
399 399
400 std::string filename; 400 std::string filename;
401 std::string ext_filename; 401 std::string ext_filename;
402 402
403 HttpUtil::NameValuePairsIterator iter(pos, end, ';'); 403 HttpUtil::NameValuePairsIterator iter(pos, end, ';');
404 while (iter.GetNext()) { 404 while (iter.GetNext()) {
405 if (filename.empty() && LowerCaseEqualsASCII(iter.name_begin(), 405 if (filename.empty() &&
406 iter.name_end(), 406 base::LowerCaseEqualsASCII(iter.name_begin(), iter.name_end(),
407 "filename")) { 407 "filename")) {
408 DecodeFilenameValue(iter.value(), referrer_charset, &filename, 408 DecodeFilenameValue(iter.value(), referrer_charset, &filename,
409 &parse_result_flags_); 409 &parse_result_flags_);
410 if (!filename.empty()) 410 if (!filename.empty())
411 parse_result_flags_ |= HAS_FILENAME; 411 parse_result_flags_ |= HAS_FILENAME;
412 } else if (ext_filename.empty() && LowerCaseEqualsASCII(iter.name_begin(), 412 } else if (ext_filename.empty() &&
413 iter.name_end(), 413 base::LowerCaseEqualsASCII(iter.name_begin(), iter.name_end(),
414 "filename*")) { 414 "filename*")) {
415 DecodeExtValue(iter.raw_value(), &ext_filename); 415 DecodeExtValue(iter.raw_value(), &ext_filename);
416 if (!ext_filename.empty()) 416 if (!ext_filename.empty())
417 parse_result_flags_ |= HAS_EXT_FILENAME; 417 parse_result_flags_ |= HAS_EXT_FILENAME;
418 } 418 }
419 } 419 }
420 420
421 if (!ext_filename.empty()) 421 if (!ext_filename.empty())
422 filename_ = ext_filename; 422 filename_ = ext_filename;
423 else 423 else
424 filename_ = filename; 424 filename_ = filename;
425 } 425 }
426 426
427 } // namespace net 427 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache_transaction.cc ('k') | net/http/http_response_headers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698