| 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 "net/base/platform_mime_util.h" | 5 #include "net/base/platform_mime_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 | 11 |
| 12 #if defined(OS_ANDROID) | 12 #if defined(OS_ANDROID) |
| 13 #include "net/android/network_library.h" | 13 #include "net/android/network_library.h" |
| 14 #elif defined(OS_CHROMEOS) |
| 15 #include "net/base/mime_extension_chromeos.h" |
| 14 #else | 16 #else |
| 15 #include "base/nix/mime_util_xdg.h" | 17 #include "base/nix/mime_util_xdg.h" |
| 16 #endif | 18 #endif |
| 17 | 19 |
| 18 namespace net { | 20 namespace net { |
| 19 | 21 |
| 20 #if defined(OS_ANDROID) | 22 #if defined(OS_ANDROID) |
| 21 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( | 23 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( |
| 22 const base::FilePath::StringType& ext, std::string* result) const { | 24 const base::FilePath::StringType& ext, std::string* result) const { |
| 23 return android::GetMimeTypeFromExtension(ext, result); | 25 return android::GetMimeTypeFromExtension(ext, result); |
| 24 } | 26 } |
| 27 #elif defined(OS_CHROMEOS) |
| 28 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( |
| 29 const base::FilePath::StringType& ext, |
| 30 std::string* result) const { |
| 31 return chromeos::GetPlatformMimeTypeFromExtension(ext, result); |
| 32 } |
| 25 #else | 33 #else |
| 26 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( | 34 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( |
| 27 const base::FilePath::StringType& ext, std::string* result) const { | 35 const base::FilePath::StringType& ext, std::string* result) const { |
| 28 // TODO(thestig): This is a temporary hack until we can fix this | 36 // TODO(thestig): This is a temporary hack until we can fix this |
| 29 // properly in test shell / webkit. | 37 // properly in test shell / webkit. |
| 30 // We have to play dumb and not return application/x-perl here | 38 // We have to play dumb and not return application/x-perl here |
| 31 // to make the reload-subframe-object layout test happy. | 39 // to make the reload-subframe-object layout test happy. |
| 32 if (ext == "pl") | 40 if (ext == "pl") |
| 33 return false; | 41 return false; |
| 34 | 42 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 109 |
| 102 void PlatformMimeUtil::GetPlatformExtensionsForMimeType( | 110 void PlatformMimeUtil::GetPlatformExtensionsForMimeType( |
| 103 const std::string& mime_type, | 111 const std::string& mime_type, |
| 104 base::hash_set<base::FilePath::StringType>* extensions) const { | 112 base::hash_set<base::FilePath::StringType>* extensions) const { |
| 105 base::FilePath::StringType ext; | 113 base::FilePath::StringType ext; |
| 106 if (GetPreferredExtensionForMimeType(mime_type, &ext)) | 114 if (GetPreferredExtensionForMimeType(mime_type, &ext)) |
| 107 extensions->insert(ext); | 115 extensions->insert(ext); |
| 108 } | 116 } |
| 109 | 117 |
| 110 } // namespace net | 118 } // namespace net |
| OLD | NEW |