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

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

Issue 196793010: Move IsStringASCII/UTF8 to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | « media/cdm/json_web_key.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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 "message/", 633 "message/",
634 "model/", 634 "model/",
635 "multipart/", 635 "multipart/",
636 "text/", 636 "text/",
637 "video/", 637 "video/",
638 }; 638 };
639 639
640 bool MimeUtil::IsMimeType(const std::string& type_string) const { 640 bool MimeUtil::IsMimeType(const std::string& type_string) const {
641 // MIME types are always ASCII and case-insensitive (at least, the top-level 641 // MIME types are always ASCII and case-insensitive (at least, the top-level
642 // and secondary types we care about). 642 // and secondary types we care about).
643 if (!IsStringASCII(type_string)) 643 if (!base::IsStringASCII(type_string))
644 return false; 644 return false;
645 645
646 if (type_string == "*/*" || type_string == "*") 646 if (type_string == "*/*" || type_string == "*")
647 return true; 647 return true;
648 648
649 for (size_t i = 0; i < arraysize(legal_top_level_types); ++i) { 649 for (size_t i = 0; i < arraysize(legal_top_level_types); ++i) {
650 if (StartsWithASCII(type_string, legal_top_level_types[i], false) && 650 if (StartsWithASCII(type_string, legal_top_level_types[i], false) &&
651 type_string.length() > strlen(legal_top_level_types[i])) { 651 type_string.length() > strlen(legal_top_level_types[i])) {
652 return true; 652 return true;
653 } 653 }
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 post_data->append("\r\n" + value + "\r\n"); 1024 post_data->append("\r\n" + value + "\r\n");
1025 } 1025 }
1026 1026
1027 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, 1027 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary,
1028 std::string* post_data) { 1028 std::string* post_data) {
1029 DCHECK(post_data); 1029 DCHECK(post_data);
1030 post_data->append("--" + mime_boundary + "--\r\n"); 1030 post_data->append("--" + mime_boundary + "--\r\n");
1031 } 1031 }
1032 1032
1033 } // namespace net 1033 } // namespace net
OLDNEW
« no previous file with comments | « media/cdm/json_web_key.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698