| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. | 3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include <time.h> | 33 #include <time.h> |
| 34 #include <wtf/Forward.h> | 34 #include <wtf/Forward.h> |
| 35 #include <wtf/MathExtras.h> | 35 #include <wtf/MathExtras.h> |
| 36 #include <wtf/Vector.h> | 36 #include <wtf/Vector.h> |
| 37 #include <wtf/text/WTFString.h> | 37 #include <wtf/text/WTFString.h> |
| 38 | 38 |
| 39 #if USE(CF) | 39 #if USE(CF) |
| 40 #include <wtf/RetainPtr.h> | 40 #include <wtf/RetainPtr.h> |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 #if PLATFORM(QT) | 43 #if USE(CF) |
| 44 #include <QFile> | |
| 45 #include <QLibrary> | |
| 46 #if defined(Q_OS_WIN32) | |
| 47 #include <windows.h> | |
| 48 #endif | |
| 49 #endif | |
| 50 | |
| 51 #if USE(CF) || (PLATFORM(QT) && defined(Q_WS_MAC)) | |
| 52 typedef struct __CFBundle* CFBundleRef; | 44 typedef struct __CFBundle* CFBundleRef; |
| 53 typedef const struct __CFData* CFDataRef; | 45 typedef const struct __CFData* CFDataRef; |
| 54 #endif | 46 #endif |
| 55 | 47 |
| 56 #if OS(WINDOWS) | 48 #if OS(WINDOWS) |
| 57 // These are to avoid including <winbase.h> in a header for Chromium | 49 // These are to avoid including <winbase.h> in a header for Chromium |
| 58 typedef void *HANDLE; | 50 typedef void *HANDLE; |
| 59 // Assuming STRICT | 51 // Assuming STRICT |
| 60 typedef struct HINSTANCE__* HINSTANCE; | 52 typedef struct HINSTANCE__* HINSTANCE; |
| 61 typedef HINSTANCE HMODULE; | 53 typedef HINSTANCE HMODULE; |
| 62 #endif | 54 #endif |
| 63 | 55 |
| 64 #if PLATFORM(GTK) | |
| 65 typedef struct _GFileIOStream GFileIOStream; | |
| 66 typedef struct _GModule GModule; | |
| 67 #endif | |
| 68 | 56 |
| 69 namespace WebCore { | 57 namespace WebCore { |
| 70 | 58 |
| 71 // PlatformModule | 59 // PlatformModule |
| 72 #if OS(WINDOWS) | 60 #if OS(WINDOWS) |
| 73 typedef HMODULE PlatformModule; | 61 typedef HMODULE PlatformModule; |
| 74 #elif PLATFORM(GTK) | |
| 75 typedef GModule* PlatformModule; | |
| 76 #elif PLATFORM(QT) | |
| 77 #if defined(Q_WS_MAC) | |
| 78 typedef CFBundleRef PlatformModule; | |
| 79 #elif !defined(QT_NO_LIBRARY) | |
| 80 typedef QLibrary* PlatformModule; | |
| 81 #else | 62 #else |
| 82 typedef void* PlatformModule; | 63 typedef void* PlatformModule; |
| 83 #endif | 64 #endif |
| 84 #elif USE(CF) | 65 #if USE(CF) |
| 85 typedef CFBundleRef PlatformModule; | 66 typedef CFBundleRef PlatformModule; |
| 86 #else | 67 #else |
| 87 typedef void* PlatformModule; | 68 typedef void* PlatformModule; |
| 88 #endif | 69 #endif |
| 89 | 70 |
| 90 // PlatformModuleVersion | 71 // PlatformModuleVersion |
| 91 #if OS(WINDOWS) | 72 #if OS(WINDOWS) |
| 92 struct PlatformModuleVersion { | 73 struct PlatformModuleVersion { |
| 93 unsigned leastSig; | 74 unsigned leastSig; |
| 94 unsigned mostSig; | 75 unsigned mostSig; |
| 95 | 76 |
| 96 PlatformModuleVersion(unsigned) | 77 PlatformModuleVersion(unsigned) |
| 97 : leastSig(0) | 78 : leastSig(0) |
| 98 , mostSig(0) | 79 , mostSig(0) |
| 99 { | 80 { |
| 100 } | 81 } |
| 101 | 82 |
| 102 PlatformModuleVersion(unsigned lsb, unsigned msb) | 83 PlatformModuleVersion(unsigned lsb, unsigned msb) |
| 103 : leastSig(lsb) | 84 : leastSig(lsb) |
| 104 , mostSig(msb) | 85 , mostSig(msb) |
| 105 { | 86 { |
| 106 } | 87 } |
| 107 | 88 |
| 108 }; | 89 }; |
| 109 #else | 90 #else |
| 110 typedef unsigned PlatformModuleVersion; | 91 typedef unsigned PlatformModuleVersion; |
| 111 #endif | 92 #endif |
| 112 | 93 |
| 113 // PlatformFileHandle | 94 // PlatformFileHandle |
| 114 #if PLATFORM(QT) | 95 #if OS(WINDOWS) |
| 115 typedef QFile* PlatformFileHandle; | |
| 116 const PlatformFileHandle invalidPlatformFileHandle = 0; | |
| 117 #elif PLATFORM(GTK) | |
| 118 typedef GFileIOStream* PlatformFileHandle; | |
| 119 const PlatformFileHandle invalidPlatformFileHandle = 0; | |
| 120 #elif OS(WINDOWS) | |
| 121 typedef HANDLE PlatformFileHandle; | 96 typedef HANDLE PlatformFileHandle; |
| 122 // FIXME: -1 is INVALID_HANDLE_VALUE, defined in <winbase.h>. Chromium tries to | 97 // FIXME: -1 is INVALID_HANDLE_VALUE, defined in <winbase.h>. Chromium tries to |
| 123 // avoid using Windows headers in headers. We'd rather move this into the .cpp. | 98 // avoid using Windows headers in headers. We'd rather move this into the .cpp. |
| 124 const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast<HANDLE>(-1
); | 99 const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast<HANDLE>(-1
); |
| 125 #else | 100 #else |
| 126 typedef int PlatformFileHandle; | 101 typedef int PlatformFileHandle; |
| 127 const PlatformFileHandle invalidPlatformFileHandle = -1; | 102 const PlatformFileHandle invalidPlatformFileHandle = -1; |
| 128 #endif | 103 #endif |
| 129 | 104 |
| 130 enum FileOpenMode { | 105 enum FileOpenMode { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 169 |
| 195 // Functions for working with loadable modules. | 170 // Functions for working with loadable modules. |
| 196 bool unloadModule(PlatformModule); | 171 bool unloadModule(PlatformModule); |
| 197 | 172 |
| 198 // Encode a string for use within a file name. | 173 // Encode a string for use within a file name. |
| 199 String encodeForFileName(const String&); | 174 String encodeForFileName(const String&); |
| 200 | 175 |
| 201 #if USE(CF) | 176 #if USE(CF) |
| 202 RetainPtr<CFURLRef> pathAsURL(const String&); | 177 RetainPtr<CFURLRef> pathAsURL(const String&); |
| 203 #endif | 178 #endif |
| 204 | 179 #if USE(SOUP) |
| 205 #if PLATFORM(MAC) | |
| 206 void setMetadataURL(String& URLString, const String& referrer, const String& pat
h); | |
| 207 #endif | |
| 208 | |
| 209 #if PLATFORM(GTK) | |
| 210 String filenameToString(const char*); | |
| 211 String filenameForDisplay(const String&); | |
| 212 CString applicationDirectoryPath(); | |
| 213 CString sharedResourcesPath(); | |
| 214 #endif | |
| 215 #if USE(SOUP) || PLATFORM(QT) | |
| 216 uint64_t getVolumeFreeSizeForPath(const char*); | 180 uint64_t getVolumeFreeSizeForPath(const char*); |
| 217 #endif | 181 #endif |
| 218 | 182 |
| 219 #if PLATFORM(WIN) && !OS(WINCE) | |
| 220 String localUserSpecificStorageDirectory(); | |
| 221 String roamingUserSpecificStorageDirectory(); | |
| 222 #endif | |
| 223 | |
| 224 #if PLATFORM(WIN) && USE(CF) | |
| 225 bool safeCreateFile(const String&, CFDataRef); | |
| 226 #endif | |
| 227 | |
| 228 } // namespace WebCore | 183 } // namespace WebCore |
| 229 | 184 |
| 230 #endif // FileSystem_h | 185 #endif // FileSystem_h |
| OLD | NEW |