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 <CoreServices/CoreServices.h> | |
8 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
9 | 8 |
10 #include <string> | 9 #include <string> |
11 | 10 |
12 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
13 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
14 #import "base/memory/scoped_nsobject.h" | 13 #import "base/memory/scoped_nsobject.h" |
15 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
16 | 15 |
| 16 #if defined(OS_IOS) |
| 17 #include <MobileCoreServices/MobileCoreServices.h> |
| 18 #else |
| 19 #include <CoreServices/CoreServices.h> |
| 20 #endif // defined(OS_IOS) |
| 21 |
17 // SPI declaration; see the commentary in GetPlatformExtensionsForMimeType. | 22 // SPI declaration; see the commentary in GetPlatformExtensionsForMimeType. |
18 | 23 |
19 @interface NSURLFileTypeMappings : NSObject | 24 @interface NSURLFileTypeMappings : NSObject |
20 + (NSURLFileTypeMappings*)sharedMappings; | 25 + (NSURLFileTypeMappings*)sharedMappings; |
21 - (NSArray*)extensionsForMIMEType:(NSString*)mimeType; | 26 - (NSArray*)extensionsForMIMEType:(NSString*)mimeType; |
22 @end | 27 @end |
23 | 28 |
24 namespace net { | 29 namespace net { |
25 | 30 |
26 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( | 31 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 extensions->insert(base::SysNSStringToUTF8(extension)); | 94 extensions->insert(base::SysNSStringToUTF8(extension)); |
90 } else { | 95 } else { |
91 // Huh? Give up. | 96 // Huh? Give up. |
92 FilePath::StringType ext; | 97 FilePath::StringType ext; |
93 if (GetPreferredExtensionForMimeType(mime_type, &ext)) | 98 if (GetPreferredExtensionForMimeType(mime_type, &ext)) |
94 extensions->insert(ext); | 99 extensions->insert(ext); |
95 } | 100 } |
96 } | 101 } |
97 | 102 |
98 } // namespace net | 103 } // namespace net |
OLD | NEW |