| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_CLIENT_IMPL_H_ | 5 #ifndef WEBKIT_CLIENT_IMPL_H_ |
| 6 #define WEBKIT_CLIENT_IMPL_H_ | 6 #define WEBKIT_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
| 9 #include "base/timer.h" | 9 #include "base/timer.h" |
| 10 #include "webkit/api/public/WebKitClient.h" | 10 #include "webkit/api/public/WebKitClient.h" |
| 11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 12 #include "webkit/glue/webthemeengine_impl_win.h" | 12 #include "webkit/glue/webthemeengine_impl_win.h" |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 class MessageLoop; | 15 class MessageLoop; |
| 16 | 16 |
| 17 namespace webkit_glue { | 17 namespace webkit_glue { |
| 18 | 18 |
| 19 class WebKitClientImpl : public WebKit::WebKitClient { | 19 class WebKitClientImpl : public WebKit::WebKitClient { |
| 20 public: | 20 public: |
| 21 WebKitClientImpl(); | 21 WebKitClientImpl(); |
| 22 | 22 |
| 23 // WebKitClient methods (partial implementation): | 23 // WebKitClient methods (partial implementation): |
| 24 virtual WebKit::WebThemeEngine* themeEngine(); | 24 virtual WebKit::WebThemeEngine* themeEngine(); |
| 25 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost( |
| 26 WebKit::WebApplicationCacheHostClient*); |
| 27 virtual WebKit::WebStorageNamespace* createLocalStorageNamespace( |
| 28 const WebKit::WebString& path, unsigned quota); |
| 29 virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(); |
| 30 virtual void dispatchStorageEvent(const WebKit::WebString& key, |
| 31 const WebKit::WebString& oldValue, const WebKit::WebString& newValue, |
| 32 const WebKit::WebString& origin, bool isLocalStorage); |
| 33 virtual bool fileExists(const WebKit::WebString& path); |
| 34 virtual bool deleteFile(const WebKit::WebString& path); |
| 35 virtual bool deleteEmptyDirectory(const WebKit::WebString& path); |
| 36 virtual bool getFileSize(const WebKit::WebString& path, long long& result); |
| 37 virtual bool getFileModificationTime( |
| 38 const WebKit::WebString& path, time_t& result); |
| 39 virtual WebKit::WebString directoryName(const WebKit::WebString& path); |
| 40 virtual WebKit::WebString pathByAppendingComponent( |
| 41 const WebKit::WebString& path, const WebKit::WebString& component); |
| 42 virtual bool makeAllDirectories(const WebKit::WebString& path); |
| 43 virtual WebKit::WebString getAbsolutePath(const WebKit::WebString& path); |
| 44 virtual bool isDirectory(const WebKit::WebString& path); |
| 45 virtual WebKit::WebURL filePathToURL(const WebKit::WebString& path); |
| 46 virtual base::PlatformFile databaseOpenFile( |
| 47 const WebKit::WebString& file_name, int desired_flags, |
| 48 base::PlatformFile* dir_handle); |
| 49 virtual int databaseDeleteFile(const WebKit::WebString& file_name, |
| 50 bool sync_dir); |
| 51 virtual long databaseGetFileAttributes(const WebKit::WebString& file_name); |
| 52 virtual long long databaseGetFileSize(const WebKit::WebString& file_name); |
| 53 virtual WebKit::WebString signedPublicKeyAndChallengeString( |
| 54 unsigned key_size_index, const WebKit::WebString& challenge, |
| 55 const WebKit::WebURL& url); |
| 25 virtual bool rawCookies(const WebKit::WebURL& url, | 56 virtual bool rawCookies(const WebKit::WebURL& url, |
| 26 const WebKit::WebURL& policy_url, | 57 const WebKit::WebURL& policy_url, |
| 27 WebKit::WebVector<WebKit::WebCookie>*); | 58 WebKit::WebVector<WebKit::WebCookie>*); |
| 28 virtual void deleteCookie(const WebKit::WebURL& url, | 59 virtual void deleteCookie(const WebKit::WebURL& url, |
| 29 const WebKit::WebString& cookie_name); | 60 const WebKit::WebString& cookie_name); |
| 30 virtual WebKit::WebURLLoader* createURLLoader(); | 61 virtual WebKit::WebURLLoader* createURLLoader(); |
| 31 virtual WebKit::WebSocketStreamHandle* createSocketStreamHandle(); | 62 virtual WebKit::WebSocketStreamHandle* createSocketStreamHandle(); |
| 63 virtual WebKit::WebString userAgent(const WebKit::WebURL& url); |
| 32 virtual void getPluginList(bool refresh, WebKit::WebPluginListBuilder*); | 64 virtual void getPluginList(bool refresh, WebKit::WebPluginListBuilder*); |
| 33 virtual void decrementStatsCounter(const char* name); | 65 virtual void decrementStatsCounter(const char* name); |
| 34 virtual void incrementStatsCounter(const char* name); | 66 virtual void incrementStatsCounter(const char* name); |
| 35 virtual void traceEventBegin(const char* name, void* id, const char* extra); | 67 virtual void traceEventBegin(const char* name, void* id, const char* extra); |
| 36 virtual void traceEventEnd(const char* name, void* id, const char* extra); | 68 virtual void traceEventEnd(const char* name, void* id, const char* extra); |
| 37 virtual WebKit::WebData loadResource(const char* name); | 69 virtual WebKit::WebData loadResource(const char* name); |
| 38 virtual WebKit::WebString queryLocalizedString( | 70 virtual WebKit::WebString queryLocalizedString( |
| 39 WebKit::WebLocalizedString::Name name); | 71 WebKit::WebLocalizedString::Name name); |
| 40 virtual WebKit::WebString queryLocalizedString( | 72 virtual WebKit::WebString queryLocalizedString( |
| 41 WebKit::WebLocalizedString::Name name, int numeric_value); | 73 WebKit::WebLocalizedString::Name name, int numeric_value); |
| 74 virtual void suddenTerminationChanged(bool enabled) { } |
| 42 virtual double currentTime(); | 75 virtual double currentTime(); |
| 43 virtual void setSharedTimerFiredFunction(void (*func)()); | 76 virtual void setSharedTimerFiredFunction(void (*func)()); |
| 44 virtual void setSharedTimerFireTime(double fireTime); | 77 virtual void setSharedTimerFireTime(double fireTime); |
| 45 virtual void stopSharedTimer(); | 78 virtual void stopSharedTimer(); |
| 46 virtual void callOnMainThread(void (*func)()); | 79 virtual void callOnMainThread(void (*func)()); |
| 47 virtual void suddenTerminationChanged(bool enabled) { } | |
| 48 virtual void dispatchStorageEvent(const WebKit::WebString& key, | |
| 49 const WebKit::WebString& oldValue, const WebKit::WebString& newValue, | |
| 50 const WebKit::WebString& origin, bool isLocalStorage); | |
| 51 | |
| 52 virtual base::PlatformFile databaseOpenFile( | |
| 53 const WebKit::WebString& file_name, int desired_flags, | |
| 54 base::PlatformFile* dir_handle); | |
| 55 virtual int databaseDeleteFile(const WebKit::WebString& file_name, | |
| 56 bool sync_dir); | |
| 57 virtual long databaseGetFileAttributes(const WebKit::WebString& file_name); | |
| 58 virtual long long databaseGetFileSize(const WebKit::WebString& file_name); | |
| 59 | |
| 60 virtual WebKit::WebString signedPublicKeyAndChallengeString( | |
| 61 unsigned key_size_index, const WebKit::WebString& challenge, | |
| 62 const WebKit::WebURL& url); | |
| 63 | |
| 64 virtual bool fileExists(const WebKit::WebString& path); | |
| 65 virtual bool deleteFile(const WebKit::WebString& path); | |
| 66 virtual bool deleteEmptyDirectory(const WebKit::WebString& path); | |
| 67 virtual bool getFileSize(const WebKit::WebString& path, long long& result); | |
| 68 virtual bool getFileModificationTime(const WebKit::WebString& path, | |
| 69 time_t& result); | |
| 70 virtual WebKit::WebString directoryName(const WebKit::WebString& path); | |
| 71 virtual WebKit::WebString pathByAppendingComponent( | |
| 72 const WebKit::WebString& path, const WebKit::WebString& component); | |
| 73 virtual bool makeAllDirectories(const WebKit::WebString& path); | |
| 74 virtual WebKit::WebString getAbsolutePath(const WebKit::WebString& path); | |
| 75 virtual bool isDirectory(const WebKit::WebString& path); | |
| 76 virtual WebKit::WebURL filePathToURL(const WebKit::WebString& path); | |
| 77 | |
| 78 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost( | |
| 79 WebKit::WebApplicationCacheHostClient*); | |
| 80 | 80 |
| 81 // These are temporary methods that the WebKit layer can use to call to the | 81 // These are temporary methods that the WebKit layer can use to call to the |
| 82 // Glue layer. Once the Glue layer moves entirely into the WebKit layer, | 82 // Glue layer. Once the Glue layer moves entirely into the WebKit layer, |
| 83 // these methods will be deleted. | 83 // these methods will be deleted. |
| 84 virtual WebKit::WebMediaPlayer* createWebMediaPlayer( | |
| 85 WebKit::WebMediaPlayerClient*, WebCore::Frame*); | |
| 86 virtual void setCursorForPlugin( | |
| 87 const WebKit::WebCursorInfo&, WebCore::Frame*); | |
| 88 virtual WebCore::String uiResourceProtocol(); | 84 virtual WebCore::String uiResourceProtocol(); |
| 89 virtual void notifyJSOutOfMemory(WebCore::Frame*); | |
| 90 virtual int screenDepth(WebCore::Widget*); | |
| 91 virtual int screenDepthPerComponent(WebCore::Widget*); | |
| 92 virtual bool screenIsMonochrome(WebCore::Widget*); | |
| 93 virtual WebCore::IntRect screenRect(WebCore::Widget*); | |
| 94 virtual WebCore::IntRect screenAvailableRect(WebCore::Widget*); | |
| 95 virtual bool popupsAllowed(NPP); | 85 virtual bool popupsAllowed(NPP); |
| 96 virtual void widgetSetCursor(WebCore::Widget*, const WebCore::Cursor&); | |
| 97 virtual void widgetSetFocus(WebCore::Widget*); | |
| 98 virtual WebCore::WorkerContextProxy* createWorkerContextProxy( | |
| 99 WebCore::Worker* worker); | |
| 100 virtual WebKit::WebStorageNamespace* createLocalStorageNamespace( | |
| 101 const WebKit::WebString& path, unsigned quota); | |
| 102 virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(); | |
| 103 | 86 |
| 104 private: | 87 private: |
| 105 void DoTimeout() { | 88 void DoTimeout() { |
| 106 if (shared_timer_func_) | 89 if (shared_timer_func_) |
| 107 shared_timer_func_(); | 90 shared_timer_func_(); |
| 108 } | 91 } |
| 109 | 92 |
| 110 MessageLoop* main_loop_; | 93 MessageLoop* main_loop_; |
| 111 base::OneShotTimer<WebKitClientImpl> shared_timer_; | 94 base::OneShotTimer<WebKitClientImpl> shared_timer_; |
| 112 void (*shared_timer_func_)(); | 95 void (*shared_timer_func_)(); |
| 113 | 96 |
| 114 #if defined(OS_WIN) | 97 #if defined(OS_WIN) |
| 115 WebThemeEngineImpl theme_engine_; | 98 WebThemeEngineImpl theme_engine_; |
| 116 #endif | 99 #endif |
| 117 }; | 100 }; |
| 118 | 101 |
| 119 } // namespace webkit_glue | 102 } // namespace webkit_glue |
| 120 | 103 |
| 121 #endif // WEBKIT_CLIENT_IMPL_H_ | 104 #endif // WEBKIT_CLIENT_IMPL_H_ |
| OLD | NEW |