| 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 14 matching lines...) Expand all Loading... |
| 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 "WebCommon.h" | 34 #include "WebCommon.h" |
| 35 #include "WebLocalizedString.h" |
| 35 | 36 |
| 36 namespace WebKit { | 37 namespace WebKit { |
| 37 class WebClipboard; | 38 class WebClipboard; |
| 38 class WebData; | 39 class WebData; |
| 39 class WebMimeRegistry; | 40 class WebMimeRegistry; |
| 40 class WebPluginListBuilder; | 41 class WebPluginListBuilder; |
| 41 class WebSandboxSupport; | 42 class WebSandboxSupport; |
| 42 class WebString; | 43 class WebString; |
| 43 class WebThemeEngine; | 44 class WebThemeEngine; |
| 44 class WebURL; | 45 class WebURL; |
| 45 class WebURLLoader; | 46 class WebURLLoader; |
| 46 struct WebPluginInfo; | 47 struct WebPluginInfo; |
| 47 template <typename T> class WebVector; | 48 template <typename T> class WebVector; |
| 48 | 49 |
| 49 class WebKitClient { | 50 class WebKitClient { |
| 50 public: | 51 public: |
| 51 // Must return non-null. | 52 // Must return non-null. |
| 52 virtual WebClipboard* clipboard() = 0; | 53 virtual WebClipboard* clipboard() = 0; |
| 53 | 54 |
| 54 // Must return non-null. | 55 // Must return non-null. |
| 55 virtual WebMimeRegistry* mimeRegistry() = 0; | 56 virtual WebMimeRegistry* mimeRegistry() = 0; |
| 56 | 57 |
| 57 // May return null if sandbox support is not necessary | 58 // May return null if sandbox support is not necessary |
| 58 virtual WebSandboxSupport* sandboxSupport() = 0; | 59 virtual WebSandboxSupport* sandboxSupport() = 0; |
| 59 | 60 |
| 60 // May return null on some platforms. | 61 // May return null on some platforms. |
| 61 virtual WebThemeEngine* themeEngine() = 0; | 62 virtual WebThemeEngine* themeEngine() = 0; |
| 62 | 63 |
| 63 | 64 |
| 65 // File ---------------------------------------------------------------- |
| 66 |
| 67 virtual bool getFileSize(const WebString& path, long long& result) = 0; |
| 68 |
| 69 |
| 64 // History ------------------------------------------------------------- | 70 // History ------------------------------------------------------------- |
| 65 | 71 |
| 66 // Returns the hash for the given canonicalized URL for use in visited | 72 // Returns the hash for the given canonicalized URL for use in visited |
| 67 // link coloring. | 73 // link coloring. |
| 68 virtual unsigned long long visitedLinkHash( | 74 virtual unsigned long long visitedLinkHash( |
| 69 const char* canonicalURL, size_t length) = 0; | 75 const char* canonicalURL, size_t length) = 0; |
| 70 | 76 |
| 71 // Returns whether the given link hash is in the user's history. The | 77 // Returns whether the given link hash is in the user's history. The |
| 72 // hash must have been generated by calling VisitedLinkHash(). | 78 // hash must have been generated by calling VisitedLinkHash(). |
| 73 virtual bool isLinkVisited(unsigned long long linkHash) = 0; | 79 virtual bool isLinkVisited(unsigned long long linkHash) = 0; |
| 74 | 80 |
| 75 | 81 |
| 76 // Network ------------------------------------------------------------- | 82 // Network ------------------------------------------------------------- |
| 77 | 83 |
| 78 virtual void setCookies( | 84 virtual void setCookies( |
| 79 const WebURL& url, const WebURL& policyURL, const WebString& cookies) = 0; | 85 const WebURL& url, const WebURL& policyURL, const WebString& cookies) = 0; |
| 80 virtual WebString cookies(const WebURL& url, const WebURL& policyURL) = 0; | 86 virtual WebString cookies(const WebURL& url, const WebURL& policyURL) = 0; |
| 81 | 87 |
| 82 // A suggestion to prefetch IP information for the given hostname. | 88 // A suggestion to prefetch IP information for the given hostname. |
| 83 virtual void prefetchHostName(const WebString&) = 0; | 89 virtual void prefetchHostName(const WebString&) = 0; |
| 84 | 90 |
| 85 // File ---------------------------------------------------------------- | |
| 86 | |
| 87 virtual bool getFileSize(const WebString& path, long long& result) = 0; | |
| 88 | |
| 89 // Returns a new WebURLLoader instance. | 91 // Returns a new WebURLLoader instance. |
| 90 virtual WebURLLoader* createURLLoader() = 0; | 92 virtual WebURLLoader* createURLLoader() = 0; |
| 91 | 93 |
| 92 | 94 |
| 93 // Plugins ------------------------------------------------------------- | 95 // Plugins ------------------------------------------------------------- |
| 94 | 96 |
| 95 // If refresh is true, then cached information should not be used to | 97 // If refresh is true, then cached information should not be used to |
| 96 // satisfy this call. | 98 // satisfy this call. |
| 97 virtual void getPluginList(bool refresh, WebPluginListBuilder*) = 0; | 99 virtual void getPluginList(bool refresh, WebPluginListBuilder*) = 0; |
| 98 | 100 |
| 99 | 101 |
| 100 // Profiling ----------------------------------------------------------- | 102 // Profiling ----------------------------------------------------------- |
| 101 | 103 |
| 102 virtual void decrementStatsCounter(const char* name) = 0; | 104 virtual void decrementStatsCounter(const char* name) = 0; |
| 103 virtual void incrementStatsCounter(const char* name) = 0; | 105 virtual void incrementStatsCounter(const char* name) = 0; |
| 104 | 106 |
| 105 // An event is identified by the pair (name, id). The extra parameter | 107 // An event is identified by the pair (name, id). The extra parameter |
| 106 // specifies additional data to log with the event. | 108 // specifies additional data to log with the event. |
| 107 virtual void traceEventBegin(const char* name, void* id, const char* extra) = 0; | 109 virtual void traceEventBegin(const char* name, void* id, const char* extra) = 0; |
| 108 virtual void traceEventEnd(const char* name, void* id, const char* extra) = 0; | 110 virtual void traceEventEnd(const char* name, void* id, const char* extra) = 0; |
| 109 | 111 |
| 110 | 112 |
| 111 // Resources ----------------------------------------------------------- | 113 // Resources ----------------------------------------------------------- |
| 112 | 114 |
| 113 // Returns a blob of data corresponding to the named resource. | 115 // Returns a blob of data corresponding to the named resource. |
| 114 virtual WebData loadResource(const char* name) = 0; | 116 virtual WebData loadResource(const char* name) = 0; |
| 115 | 117 |
| 118 // Returns a localized string resource (with an optional numeric |
| 119 // parameter value). |
| 120 virtual WebString queryLocalizedString(WebLocalizedString::Name) = 0; |
| 121 virtual WebString queryLocalizedString(WebLocalizedString::Name, int numericValue) = 0; |
| 122 |
| 116 | 123 |
| 117 // Sudden Termination -------------------------------------------------- | 124 // Sudden Termination -------------------------------------------------- |
| 118 | 125 |
| 119 // Disable/Enable sudden termination. | 126 // Disable/Enable sudden termination. |
| 120 virtual void suddenTerminationChanged(bool enabled) = 0; | 127 virtual void suddenTerminationChanged(bool enabled) = 0; |
| 121 | 128 |
| 122 | 129 |
| 123 // System -------------------------------------------------------------- | 130 // System -------------------------------------------------------------- |
| 124 | 131 |
| 125 // Returns a value such as "en-US". | 132 // Returns a value such as "en-US". |
| 126 virtual WebString defaultLocale() = 0; | 133 virtual WebString defaultLocale() = 0; |
| 127 | 134 |
| 128 // Wall clock time in seconds since the epoch. | 135 // Wall clock time in seconds since the epoch. |
| 129 virtual double currentTime() = 0; | 136 virtual double currentTime() = 0; |
| 130 | 137 |
| 131 // Delayed work is driven by a shared timer. | 138 // Delayed work is driven by a shared timer. |
| 132 virtual void setSharedTimerFiredFunction(void (*func)()) = 0; | 139 virtual void setSharedTimerFiredFunction(void (*func)()) = 0; |
| 133 virtual void setSharedTimerFireTime(double fireTime) = 0; | 140 virtual void setSharedTimerFireTime(double fireTime) = 0; |
| 134 virtual void stopSharedTimer() = 0; | 141 virtual void stopSharedTimer() = 0; |
| 135 | 142 |
| 136 // Callable from a background WebKit thread. | 143 // Callable from a background WebKit thread. |
| 137 virtual void callOnMainThread(void (*func)()) = 0; | 144 virtual void callOnMainThread(void (*func)()) = 0; |
| 138 }; | 145 }; |
| 139 | 146 |
| 140 } // namespace WebKit | 147 } // namespace WebKit |
| 141 | 148 |
| 142 #endif | 149 #endif |
| OLD | NEW |