OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |