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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 return g_mime_util.Get().GetMimeTypeFromFile(file_path, mime_type); | 352 return g_mime_util.Get().GetMimeTypeFromFile(file_path, mime_type); |
353 } | 353 } |
354 | 354 |
355 bool GetWellKnownMimeTypeFromExtension(const base::FilePath::StringType& ext, | 355 bool GetWellKnownMimeTypeFromExtension(const base::FilePath::StringType& ext, |
356 std::string* mime_type) { | 356 std::string* mime_type) { |
357 return g_mime_util.Get().GetWellKnownMimeTypeFromExtension(ext, mime_type); | 357 return g_mime_util.Get().GetWellKnownMimeTypeFromExtension(ext, mime_type); |
358 } | 358 } |
359 | 359 |
360 bool GetPreferredExtensionForMimeType(const std::string& mime_type, | 360 bool GetPreferredExtensionForMimeType(const std::string& mime_type, |
361 base::FilePath::StringType* extension) { | 361 base::FilePath::StringType* extension) { |
362 // Force .crt extension for client certificates. | |
363 if (mime_type == "application/x-x509-user-cert") { | |
364 #if defined(OS_WIN) | |
365 *extension = base::UTF8ToUTF16("crt"); | |
366 #else | |
367 *extension = "crt"; | |
368 #endif | |
Ryan Sleevi
2015/10/30 23:33:47
BUG: Don't #ifdef this
*extension = FILE_PATH_LIT
svaldez
2015/11/02 16:27:38
Done.
| |
369 return true; | |
370 } | |
371 | |
362 return g_mime_util.Get().GetPreferredExtensionForMimeType(mime_type, | 372 return g_mime_util.Get().GetPreferredExtensionForMimeType(mime_type, |
363 extension); | 373 extension); |
364 } | 374 } |
365 | 375 |
366 bool MatchesMimeType(const std::string& mime_type_pattern, | 376 bool MatchesMimeType(const std::string& mime_type_pattern, |
367 const std::string& mime_type) { | 377 const std::string& mime_type) { |
368 return g_mime_util.Get().MatchesMimeType(mime_type_pattern, mime_type); | 378 return g_mime_util.Get().MatchesMimeType(mime_type_pattern, mime_type); |
369 } | 379 } |
370 | 380 |
371 bool ParseMimeTypeWithoutParameter(const std::string& type_string, | 381 bool ParseMimeTypeWithoutParameter(const std::string& type_string, |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 post_data->append("\r\n" + value + "\r\n"); | 590 post_data->append("\r\n" + value + "\r\n"); |
581 } | 591 } |
582 | 592 |
583 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, | 593 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, |
584 std::string* post_data) { | 594 std::string* post_data) { |
585 DCHECK(post_data); | 595 DCHECK(post_data); |
586 post_data->append("--" + mime_boundary + "--\r\n"); | 596 post_data->append("--" + mime_boundary + "--\r\n"); |
587 } | 597 } |
588 | 598 |
589 } // namespace net | 599 } // namespace net |
OLD | NEW |