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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |