diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 18:45:47 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 18:45:47 +0000 |
commit | c7cfaa98f8f558ccb94ce8a0dbd7057d99be17d5 (patch) | |
tree | 63dec16696d767a035c80f55e053eb54785b82ac /webkit/glue/webkitclient_impl.cc | |
parent | 20b204aefb86cd866e76fbcec0c9fa473be9d09c (diff) | |
download | chromium_src-c7cfaa98f8f558ccb94ce8a0dbd7057d99be17d5.zip chromium_src-c7cfaa98f8f558ccb94ce8a0dbd7057d99be17d5.tar.gz chromium_src-c7cfaa98f8f558ccb94ce8a0dbd7057d99be17d5.tar.bz2 |
Flesh out more of ChromiumBridge.cpp eliminating all but two methods on
TemporaryGlue.
Adds WebKitClient::userAgent() function to avoid a webkit_glue dependency.
R=dglazkov
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/350003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30609 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webkitclient_impl.cc')
-rw-r--r-- | webkit/glue/webkitclient_impl.cc | 190 |
1 files changed, 35 insertions, 155 deletions
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc index d29f73d..07cacbc 100644 --- a/webkit/glue/webkitclient_impl.cc +++ b/webkit/glue/webkitclient_impl.cc @@ -23,7 +23,6 @@ #include "grit/webkit_strings.h" #include "net/base/net_util.h" #include "webkit/api/public/WebCookie.h" -#include "webkit/api/public/WebCursorInfo.h" #include "webkit/api/public/WebData.h" #include "webkit/api/public/WebFrameClient.h" #include "webkit/api/public/WebPluginListBuilder.h" @@ -31,11 +30,6 @@ #include "webkit/api/public/WebString.h" #include "webkit/api/public/WebVector.h" #include "webkit/api/public/WebURL.h" -#include "webkit/api/public/WebViewClient.h" -#include "webkit/api/src/ChromeClientImpl.h" -#include "webkit/api/src/WebFrameImpl.h" -#include "webkit/api/src/WebViewImpl.h" -#include "webkit/api/src/WebWorkerClientImpl.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/plugins/plugin_instance.h" #include "webkit/glue/webkit_glue.h" @@ -43,13 +37,10 @@ #include "webkit/glue/websocketstreamhandle_impl.h" #include "webkit/glue/weburlloader_impl.h" -using WebKit::ChromeClientImpl; using WebKit::WebApplicationCacheHost; using WebKit::WebApplicationCacheHostClient; using WebKit::WebCookie; -using WebKit::WebCursorInfo; using WebKit::WebData; -using WebKit::WebFrameImpl; using WebKit::WebLocalizedString; using WebKit::WebPluginListBuilder; using WebKit::WebStorageNamespace; @@ -59,37 +50,6 @@ using WebKit::WebThemeEngine; using WebKit::WebURL; using WebKit::WebURLLoader; using WebKit::WebVector; -using WebKit::WebViewImpl; -using WebKit::WebWidgetClient; -using WebKit::WebWorkerClientImpl; - -namespace { - -ChromeClientImpl* ToChromeClient(WebCore::Widget* widget) { - WebCore::FrameView* view; - if (widget->isFrameView()) { - view = static_cast<WebCore::FrameView*>(widget); - } else if (widget->parent() && widget->parent()->isFrameView()) { - view = static_cast<WebCore::FrameView*>(widget->parent()); - } else { - return NULL; - } - - WebCore::Page* page = view->frame() ? view->frame()->page() : NULL; - if (!page) - return NULL; - - return static_cast<ChromeClientImpl*>(page->chrome()->client()); -} - -WebWidgetClient* ToWebWidgetClient(WebCore::Widget* widget) { - ChromeClientImpl* chrome_client = ToChromeClient(widget); - if (!chrome_client || !chrome_client->webview()) - return NULL; - return chrome_client->webview()->client(); -} - -} namespace webkit_glue { @@ -183,6 +143,10 @@ WebSocketStreamHandle* WebKitClientImpl::createSocketStreamHandle() { return new WebSocketStreamHandleImpl(); } +WebString WebKitClientImpl::userAgent(const WebURL& url) { + return WebString::fromUTF8(webkit_glue::GetUserAgent(url)); +} + void WebKitClientImpl::getPluginList(bool refresh, WebPluginListBuilder* builder) { std::vector<WebPluginInfo> plugins; @@ -326,6 +290,17 @@ void WebKitClientImpl::callOnMainThread(void (*func)()) { main_loop_->PostTask(FROM_HERE, NewRunnableFunction(func)); } +WebStorageNamespace* WebKitClientImpl::createLocalStorageNamespace( + const WebString& path, unsigned quota) { + NOTREACHED(); + return 0; +} + +WebStorageNamespace* WebKitClientImpl::createSessionStorageNamespace() { + NOTREACHED(); + return 0; +} + void WebKitClientImpl::dispatchStorageEvent(const WebString& key, const WebString& oldValue, const WebString& newValue, const WebString& origin, bool isLocalStorage) { @@ -412,45 +387,30 @@ bool WebKitClientImpl::makeAllDirectories( return file_util::CreateDirectory(FilePath(file_path)); } -//-------------------------------------------------------------------------- - -// These are temporary methods that the WebKit layer can use to call to the -// Glue layer. Once the Glue layer moves entirely into the WebKit layer, these -// methods will be deleted. - -WebKit::WebMediaPlayer* WebKitClientImpl::createWebMediaPlayer( - WebKit::WebMediaPlayerClient* client, WebCore::Frame* frame) { - WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); - if (!webframe->client()) - return NULL; - - return webframe->client()->createMediaPlayer(webframe, client); +WebKit::WebString WebKitClientImpl::getAbsolutePath( + const WebKit::WebString& path) { + FilePath file_path(webkit_glue::WebStringToFilePathString(path)); + file_util::AbsolutePath(&file_path); + return webkit_glue::FilePathStringToWebString(file_path.value()); } -void WebKitClientImpl::setCursorForPlugin( - const WebKit::WebCursorInfo& cursor_info, WebCore::Frame* frame) { - WebCore::Page* page = frame->page(); - if (!page) - return; - - ChromeClientImpl* chrome_client = - static_cast<ChromeClientImpl*>(page->chrome()->client()); +bool WebKitClientImpl::isDirectory(const WebKit::WebString& path) { + FilePath file_path(webkit_glue::WebStringToFilePathString(path)); + return file_util::DirectoryExists(file_path); +} - // A windowless plugin can change the cursor in response to the WM_MOUSEMOVE - // event. We need to reflect the changed cursor in the frame view as the - // mouse is moved in the boundaries of the windowless plugin. - chrome_client->setCursorForPlugin(cursor_info); +WebKit::WebURL WebKitClientImpl::filePathToURL(const WebKit::WebString& path) { + FilePath file_path(webkit_glue::WebStringToFilePathString(path)); + GURL file_url = net::FilePathToFileURL(file_path); + return webkit_glue::KURLToWebURL(webkit_glue::GURLToKURL(file_url)); } -void WebKitClientImpl::notifyJSOutOfMemory(WebCore::Frame* frame) { - if (!frame) - return; +//-------------------------------------------------------------------------- +// BEGIN(TemporaryGlue) - WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); - if (!webframe->client()) - return; - webframe->client()->didExhaustMemoryAvailableForScript(webframe); -} +// These are temporary methods that the WebKit layer can use to call to the +// Glue layer. Once the Glue layer moves entirely into the WebKit layer, these +// methods will be deleted. bool WebKitClientImpl::popupsAllowed(NPP npp) { bool popups_allowed = false; @@ -467,87 +427,7 @@ WebCore::String WebKitClientImpl::uiResourceProtocol() { return StdStringToString(webkit_glue::GetUIResourceProtocol()); } -int WebKitClientImpl::screenDepth(WebCore::Widget* widget) { - WebKit::WebWidgetClient* client = ToWebWidgetClient(widget); - if (!client) - return 0; - return client->screenInfo().depth; -} - -int WebKitClientImpl::screenDepthPerComponent(WebCore::Widget* widget) { - WebKit::WebWidgetClient* client = ToWebWidgetClient(widget); - if (!client) - return 0; - return client->screenInfo().depthPerComponent; -} - -bool WebKitClientImpl::screenIsMonochrome(WebCore::Widget* widget) { - WebKit::WebWidgetClient* client = ToWebWidgetClient(widget); - if (!client) - return false; - return client->screenInfo().isMonochrome; -} - -WebCore::IntRect WebKitClientImpl::screenRect(WebCore::Widget* widget) { - WebKit::WebWidgetClient* client = ToWebWidgetClient(widget); - if (!client) - return WebCore::IntRect(); - return ToIntRect(client->screenInfo().rect); -} - -WebCore::IntRect WebKitClientImpl::screenAvailableRect( - WebCore::Widget* widget) { - WebKit::WebWidgetClient* client = ToWebWidgetClient(widget); - if (!client) - return WebCore::IntRect(); - return ToIntRect(client->screenInfo().availableRect); -} - -void WebKitClientImpl::widgetSetCursor(WebCore::Widget* widget, - const WebCore::Cursor& cursor) { - ChromeClientImpl* chrome_client = ToChromeClient(widget); - if (chrome_client) - chrome_client->setCursor(CursorToWebCursorInfo(cursor)); -} - -void WebKitClientImpl::widgetSetFocus(WebCore::Widget* widget) { - ChromeClientImpl* chrome_client = ToChromeClient(widget); - if (chrome_client) - chrome_client->focus(); -} - -WebCore::WorkerContextProxy* WebKitClientImpl::createWorkerContextProxy( - WebCore::Worker* worker) { - return WebWorkerClientImpl::createWorkerContextProxy(worker); -} - -WebStorageNamespace* WebKitClientImpl::createLocalStorageNamespace( - const WebString& path, unsigned quota) { - NOTREACHED(); - return 0; -} - -WebStorageNamespace* WebKitClientImpl::createSessionStorageNamespace() { - NOTREACHED(); - return 0; -} - -WebKit::WebString WebKitClientImpl::getAbsolutePath( - const WebKit::WebString& path) { - FilePath file_path(webkit_glue::WebStringToFilePathString(path)); - file_util::AbsolutePath(&file_path); - return webkit_glue::FilePathStringToWebString(file_path.value()); -} - -bool WebKitClientImpl::isDirectory(const WebKit::WebString& path) { - FilePath file_path(webkit_glue::WebStringToFilePathString(path)); - return file_util::DirectoryExists(file_path); -} - -WebKit::WebURL WebKitClientImpl::filePathToURL(const WebKit::WebString& path) { - FilePath file_path(webkit_glue::WebStringToFilePathString(path)); - GURL file_url = net::FilePathToFileURL(file_path); - return webkit_glue::KURLToWebURL(webkit_glue::GURLToKURL(file_url)); -} +// END(TemporaryGlue) +//-------------------------------------------------------------------------- } // namespace webkit_glue |