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