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 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 { "audio/", kStandardAudioTypes, arraysize(kStandardAudioTypes) }, | 1268 { "audio/", kStandardAudioTypes, arraysize(kStandardAudioTypes) }, |
1269 { "video/", kStandardVideoTypes, arraysize(kStandardVideoTypes) }, | 1269 { "video/", kStandardVideoTypes, arraysize(kStandardVideoTypes) }, |
1270 { NULL, NULL, 0 } | 1270 { NULL, NULL, 0 } |
1271 }; | 1271 }; |
1272 | 1272 |
1273 void GetExtensionsFromHardCodedMappings( | 1273 void GetExtensionsFromHardCodedMappings( |
1274 const MimeInfo* mappings, | 1274 const MimeInfo* mappings, |
1275 size_t mappings_len, | 1275 size_t mappings_len, |
1276 const std::string& leading_mime_type, | 1276 const std::string& leading_mime_type, |
1277 base::hash_set<base::FilePath::StringType>* extensions) { | 1277 base::hash_set<base::FilePath::StringType>* extensions) { |
1278 base::FilePath::StringType extension; | |
1279 for (size_t i = 0; i < mappings_len; ++i) { | 1278 for (size_t i = 0; i < mappings_len; ++i) { |
1280 if (StartsWithASCII(mappings[i].mime_type, leading_mime_type, false)) { | 1279 if (StartsWithASCII(mappings[i].mime_type, leading_mime_type, false)) { |
1281 std::vector<string> this_extensions; | 1280 std::vector<string> this_extensions; |
1282 base::SplitString(mappings[i].extensions, ',', &this_extensions); | 1281 base::SplitString(mappings[i].extensions, ',', &this_extensions); |
1283 for (size_t j = 0; j < this_extensions.size(); ++j) { | 1282 for (size_t j = 0; j < this_extensions.size(); ++j) { |
1284 #if defined(OS_WIN) | 1283 #if defined(OS_WIN) |
1285 base::FilePath::StringType extension( | 1284 base::FilePath::StringType extension( |
1286 base::UTF8ToWide(this_extensions[j])); | 1285 base::UTF8ToWide(this_extensions[j])); |
1287 #else | 1286 #else |
1288 base::FilePath::StringType extension(this_extensions[j]); | 1287 base::FilePath::StringType extension(this_extensions[j]); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 post_data->append("\r\n" + value + "\r\n"); | 1417 post_data->append("\r\n" + value + "\r\n"); |
1419 } | 1418 } |
1420 | 1419 |
1421 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, | 1420 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, |
1422 std::string* post_data) { | 1421 std::string* post_data) { |
1423 DCHECK(post_data); | 1422 DCHECK(post_data); |
1424 post_data->append("--" + mime_boundary + "--\r\n"); | 1423 post_data->append("--" + mime_boundary + "--\r\n"); |
1425 } | 1424 } |
1426 | 1425 |
1427 } // namespace net | 1426 } // namespace net |
OLD | NEW |