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

Side by Side Diff: net/base/mime_util.cc

Issue 1233043003: Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « mojo/runner/shell_apptest.cc ('k') | net/base/net_util.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 <algorithm> 5 #include <algorithm>
6 #include <iterator> 6 #include <iterator>
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 517
518 void GetExtensionsForMimeType( 518 void GetExtensionsForMimeType(
519 const std::string& unsafe_mime_type, 519 const std::string& unsafe_mime_type,
520 std::vector<base::FilePath::StringType>* extensions) { 520 std::vector<base::FilePath::StringType>* extensions) {
521 if (unsafe_mime_type == "*/*" || unsafe_mime_type == "*") 521 if (unsafe_mime_type == "*/*" || unsafe_mime_type == "*")
522 return; 522 return;
523 523
524 const std::string mime_type = base::StringToLowerASCII(unsafe_mime_type); 524 const std::string mime_type = base::StringToLowerASCII(unsafe_mime_type);
525 base::hash_set<base::FilePath::StringType> unique_extensions; 525 base::hash_set<base::FilePath::StringType> unique_extensions;
526 526
527 if (base::EndsWith(mime_type, "/*", false)) { 527 if (base::EndsWith(mime_type, "/*", base::CompareCase::INSENSITIVE_ASCII)) {
528 std::string leading_mime_type = mime_type.substr(0, mime_type.length() - 1); 528 std::string leading_mime_type = mime_type.substr(0, mime_type.length() - 1);
529 529
530 // Find the matching StandardType from within kStandardTypes, or fall 530 // Find the matching StandardType from within kStandardTypes, or fall
531 // through to the last (default) StandardType. 531 // through to the last (default) StandardType.
532 const StandardType* type = NULL; 532 const StandardType* type = NULL;
533 for (size_t i = 0; i < arraysize(kStandardTypes); ++i) { 533 for (size_t i = 0; i < arraysize(kStandardTypes); ++i) {
534 type = &(kStandardTypes[i]); 534 type = &(kStandardTypes[i]);
535 if (type->leading_mime_type && 535 if (type->leading_mime_type &&
536 leading_mime_type == type->leading_mime_type) 536 leading_mime_type == type->leading_mime_type)
537 break; 537 break;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 post_data->append("\r\n" + value + "\r\n"); 580 post_data->append("\r\n" + value + "\r\n");
581 } 581 }
582 582
583 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, 583 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary,
584 std::string* post_data) { 584 std::string* post_data) {
585 DCHECK(post_data); 585 DCHECK(post_data);
586 post_data->append("--" + mime_boundary + "--\r\n"); 586 post_data->append("--" + mime_boundary + "--\r\n");
587 } 587 }
588 588
589 } // namespace net 589 } // namespace net
OLDNEW
« no previous file with comments | « mojo/runner/shell_apptest.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698