OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebKitClient_h | 31 #ifndef WebKitClient_h |
32 #define WebKitClient_h | 32 #define WebKitClient_h |
33 | 33 |
| 34 #include <time.h> |
| 35 |
34 #include "WebCommon.h" | 36 #include "WebCommon.h" |
35 #include "WebLocalizedString.h" | 37 #include "WebLocalizedString.h" |
36 | 38 |
37 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
38 #include <windows.h> | 40 #include <windows.h> |
39 #endif | 41 #endif |
40 | 42 |
41 namespace WebKit { | 43 namespace WebKit { |
42 class WebClipboard; | 44 class WebClipboard; |
43 class WebData; | 45 class WebData; |
(...skipping 30 matching lines...) Expand all Loading... |
74 // path. | 76 // path. |
75 virtual WebStorageNamespace* createLocalStorageNamespace( | 77 virtual WebStorageNamespace* createLocalStorageNamespace( |
76 const WebString& path) = 0; | 78 const WebString& path) = 0; |
77 | 79 |
78 // Return a new SessionStorage namespace. | 80 // Return a new SessionStorage namespace. |
79 virtual WebStorageNamespace* createSessionStorageNamespace() = 0; | 81 virtual WebStorageNamespace* createSessionStorageNamespace() = 0; |
80 | 82 |
81 | 83 |
82 // File ---------------------------------------------------------------- | 84 // File ---------------------------------------------------------------- |
83 | 85 |
| 86 // Various file/directory related functions. These map 1:1 with |
| 87 // functions in WebCore's FileSystem.h. |
| 88 virtual bool fileExists(const WebString& path) = 0; |
| 89 virtual bool deleteFile(const WebString& path) = 0; |
| 90 virtual bool deleteEmptyDirectory(const WebString& path) = 0; |
84 virtual bool getFileSize(const WebString& path, long long& result) = 0; | 91 virtual bool getFileSize(const WebString& path, long long& result) = 0; |
| 92 virtual bool getFileModificationTime(const WebString& path, time_t& result) = 0; |
| 93 virtual WebString directoryName(const WebString& path) = 0; |
| 94 virtual WebString pathByAppendingComponent(const WebString& path, const WebString& component) = 0; |
| 95 virtual bool makeAllDirectories(const WebString& path) = 0; |
85 | 96 |
86 | 97 |
87 // History ------------------------------------------------------------- | 98 // History ------------------------------------------------------------- |
88 | 99 |
89 // Returns the hash for the given canonicalized URL for use in visited | 100 // Returns the hash for the given canonicalized URL for use in visited |
90 // link coloring. | 101 // link coloring. |
91 virtual unsigned long long visitedLinkHash( | 102 virtual unsigned long long visitedLinkHash( |
92 const char* canonicalURL, size_t length) = 0; | 103 const char* canonicalURL, size_t length) = 0; |
93 | 104 |
94 // Returns whether the given link hash is in the user's history. The | 105 // Returns whether the given link hash is in the user's history. The |
95 // hash must have been generated by calling VisitedLinkHash(). | 106 // hash must have been generated by calling VisitedLinkHash(). |
96 virtual bool isLinkVisited(unsigned long long linkHash) = 0; | 107 virtual bool isLinkVisited(unsigned long long linkHash) = 0; |
97 | 108 |
| 109 // HTML5 DB ------------------------------------------------------------ |
| 110 |
| 111 #if defined(OS_WIN) |
| 112 typedef HANDLE FileType; |
| 113 #else |
| 114 typedef int FileType; |
| 115 #endif |
| 116 |
| 117 // Opens a database file |
| 118 virtual FileType databaseOpenFile(const WebString& fileName, int desiredFlags) = 0; |
| 119 |
| 120 // Deletes a database file and returns the error code |
| 121 virtual bool databaseDeleteFile(const WebString& fileName) = 0; |
| 122 |
| 123 // Returns the attributes of the given database file |
| 124 virtual long databaseGetFileAttributes(const WebString& fileName) = 0; |
| 125 |
| 126 // Returns the size of the given database file |
| 127 virtual long long databaseGetFileSize(const WebString& fileName) = 0; |
| 128 |
98 | 129 |
99 // Message Ports ------------------------------------------------------- | 130 // Message Ports ------------------------------------------------------- |
100 | 131 |
101 // Creates a Message Port Channel. This can be called on any thread. | 132 // Creates a Message Port Channel. This can be called on any thread. |
102 // The returned object should only be used on the thread it was created on. | 133 // The returned object should only be used on the thread it was created on. |
103 virtual WebMessagePortChannel* createMessagePortChannel() = 0; | 134 virtual WebMessagePortChannel* createMessagePortChannel() = 0; |
104 | 135 |
105 | 136 |
106 // Network ------------------------------------------------------------- | 137 // Network ------------------------------------------------------------- |
107 | 138 |
(...skipping 30 matching lines...) Expand all Loading... |
138 | 169 |
139 // Returns a blob of data corresponding to the named resource. | 170 // Returns a blob of data corresponding to the named resource. |
140 virtual WebData loadResource(const char* name) = 0; | 171 virtual WebData loadResource(const char* name) = 0; |
141 | 172 |
142 // Returns a localized string resource (with an optional numeric | 173 // Returns a localized string resource (with an optional numeric |
143 // parameter value). | 174 // parameter value). |
144 virtual WebString queryLocalizedString(WebLocalizedString::Name) = 0; | 175 virtual WebString queryLocalizedString(WebLocalizedString::Name) = 0; |
145 virtual WebString queryLocalizedString(WebLocalizedString::Name, int numericValue) = 0; | 176 virtual WebString queryLocalizedString(WebLocalizedString::Name, int numericValue) = 0; |
146 | 177 |
147 | 178 |
| 179 // Sandbox ------------------------------------------------------------ |
| 180 |
| 181 // In some browsers, a "sandbox" restricts what operations a program |
| 182 // is allowed to preform. Such operations are typically abstracted out |
| 183 // via this API, but sometimes (like in HTML 5 database opening) WebKit |
| 184 // needs to behave differently based on whether it's restricted or not. |
| 185 // In these cases (and these cases only) you can call this function. |
| 186 // It's OK for this value to be conservitive (i.e. true even if the |
| 187 // sandbox isn't active). |
| 188 virtual bool sandboxEnabled() = 0; |
| 189 |
| 190 |
148 // Sudden Termination -------------------------------------------------- | 191 // Sudden Termination -------------------------------------------------- |
149 | 192 |
150 // Disable/Enable sudden termination. | 193 // Disable/Enable sudden termination. |
151 virtual void suddenTerminationChanged(bool enabled) = 0; | 194 virtual void suddenTerminationChanged(bool enabled) = 0; |
152 | 195 |
153 | 196 |
154 // System -------------------------------------------------------------- | 197 // System -------------------------------------------------------------- |
155 | 198 |
156 // Returns a value such as "en-US". | 199 // Returns a value such as "en-US". |
157 virtual WebString defaultLocale() = 0; | 200 virtual WebString defaultLocale() = 0; |
158 | 201 |
159 // Wall clock time in seconds since the epoch. | 202 // Wall clock time in seconds since the epoch. |
160 virtual double currentTime() = 0; | 203 virtual double currentTime() = 0; |
161 | 204 |
162 // Delayed work is driven by a shared timer. | 205 // Delayed work is driven by a shared timer. |
163 virtual void setSharedTimerFiredFunction(void (*func)()) = 0; | 206 virtual void setSharedTimerFiredFunction(void (*func)()) = 0; |
164 virtual void setSharedTimerFireTime(double fireTime) = 0; | 207 virtual void setSharedTimerFireTime(double fireTime) = 0; |
165 virtual void stopSharedTimer() = 0; | 208 virtual void stopSharedTimer() = 0; |
166 | 209 |
167 // Callable from a background WebKit thread. | 210 // Callable from a background WebKit thread. |
168 virtual void callOnMainThread(void (*func)()) = 0; | 211 virtual void callOnMainThread(void (*func)()) = 0; |
169 | |
170 // HTML5 DB ------------------------------------------------------------ | |
171 | |
172 #if defined(OS_WIN) | |
173 typedef HANDLE FileType; | |
174 #else | |
175 typedef int FileType; | |
176 #endif | |
177 | |
178 // Opens a database file | |
179 virtual FileType databaseOpenFile(const WebString& fileName, int desiredFlags) = 0; | |
180 | |
181 // Deletes a database file and returns the error code | |
182 virtual bool databaseDeleteFile(const WebString& fileName) = 0; | |
183 | |
184 // Returns the attributes of the given database file | |
185 virtual long databaseGetFileAttributes(const WebString& fileName) = 0; | |
186 | |
187 // Returns the size of the given database file | |
188 virtual long long databaseGetFileSize(const WebString& fileName) = 0; | |
189 }; | 212 }; |
190 | 213 |
191 } // namespace WebKit | 214 } // namespace WebKit |
192 | 215 |
193 #endif | 216 #endif |
OLD | NEW |