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

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

Issue 270183002: Move IsStringUTF8/ASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more minor nit Created 6 years, 7 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/base/filename_util.cc ('k') | net/dns/dns_config_service_win.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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 "message/", 643 "message/",
644 "model/", 644 "model/",
645 "multipart/", 645 "multipart/",
646 "text/", 646 "text/",
647 "video/", 647 "video/",
648 }; 648 };
649 649
650 bool MimeUtil::IsMimeType(const std::string& type_string) const { 650 bool MimeUtil::IsMimeType(const std::string& type_string) const {
651 // MIME types are always ASCII and case-insensitive (at least, the top-level 651 // MIME types are always ASCII and case-insensitive (at least, the top-level
652 // and secondary types we care about). 652 // and secondary types we care about).
653 if (!IsStringASCII(type_string)) 653 if (!base::IsStringASCII(type_string))
654 return false; 654 return false;
655 655
656 if (type_string == "*/*" || type_string == "*") 656 if (type_string == "*/*" || type_string == "*")
657 return true; 657 return true;
658 658
659 for (size_t i = 0; i < arraysize(legal_top_level_types); ++i) { 659 for (size_t i = 0; i < arraysize(legal_top_level_types); ++i) {
660 if (StartsWithASCII(type_string, legal_top_level_types[i], false) && 660 if (StartsWithASCII(type_string, legal_top_level_types[i], false) &&
661 type_string.length() > strlen(legal_top_level_types[i])) { 661 type_string.length() > strlen(legal_top_level_types[i])) {
662 return true; 662 return true;
663 } 663 }
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 post_data->append("\r\n" + value + "\r\n"); 1034 post_data->append("\r\n" + value + "\r\n");
1035 } 1035 }
1036 1036
1037 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, 1037 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary,
1038 std::string* post_data) { 1038 std::string* post_data) {
1039 DCHECK(post_data); 1039 DCHECK(post_data);
1040 post_data->append("--" + mime_boundary + "--\r\n"); 1040 post_data->append("--" + mime_boundary + "--\r\n");
1041 } 1041 }
1042 1042
1043 } // namespace net 1043 } // namespace net
OLDNEW
« no previous file with comments | « net/base/filename_util.cc ('k') | net/dns/dns_config_service_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698