| 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 #include <math.h> | 5 #include <math.h> |
| 6 #include "config.h" | 6 #include "config.h" |
| 7 | 7 |
| 8 #include "FrameView.h" | 8 #include "FrameView.h" |
| 9 #include "ScrollView.h" | 9 #include "ScrollView.h" |
| 10 #include <wtf/Assertions.h> | 10 #include <wtf/Assertions.h> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "webkit/api/public/WebCursorInfo.h" | 26 #include "webkit/api/public/WebCursorInfo.h" |
| 27 #include "webkit/api/public/WebData.h" | 27 #include "webkit/api/public/WebData.h" |
| 28 #include "webkit/api/public/WebFrameClient.h" | 28 #include "webkit/api/public/WebFrameClient.h" |
| 29 #include "webkit/api/public/WebPluginListBuilder.h" | 29 #include "webkit/api/public/WebPluginListBuilder.h" |
| 30 #include "webkit/api/public/WebScreenInfo.h" | 30 #include "webkit/api/public/WebScreenInfo.h" |
| 31 #include "webkit/api/public/WebString.h" | 31 #include "webkit/api/public/WebString.h" |
| 32 #include "webkit/api/public/WebVector.h" | 32 #include "webkit/api/public/WebVector.h" |
| 33 #include "webkit/api/public/WebURL.h" | 33 #include "webkit/api/public/WebURL.h" |
| 34 #include "webkit/api/public/WebViewClient.h" | 34 #include "webkit/api/public/WebViewClient.h" |
| 35 #include "webkit/api/src/ChromeClientImpl.h" | 35 #include "webkit/api/src/ChromeClientImpl.h" |
| 36 #include "webkit/api/src/WebFrameImpl.h" |
| 37 #include "webkit/api/src/WebViewImpl.h" |
| 36 #include "webkit/api/src/WebWorkerClientImpl.h" | 38 #include "webkit/api/src/WebWorkerClientImpl.h" |
| 37 #include "webkit/glue/glue_util.h" | 39 #include "webkit/glue/glue_util.h" |
| 38 #include "webkit/glue/plugins/plugin_instance.h" | 40 #include "webkit/glue/plugins/plugin_instance.h" |
| 39 #include "webkit/glue/webkit_glue.h" | 41 #include "webkit/glue/webkit_glue.h" |
| 40 #include "webkit/glue/webplugininfo.h" | 42 #include "webkit/glue/webplugininfo.h" |
| 41 #include "webkit/glue/websocketstreamhandle_impl.h" | 43 #include "webkit/glue/websocketstreamhandle_impl.h" |
| 42 #include "webkit/glue/weburlloader_impl.h" | 44 #include "webkit/glue/weburlloader_impl.h" |
| 43 #include "webkit/glue/webview_impl.h" | |
| 44 | 45 |
| 45 using WebKit::ChromeClientImpl; | 46 using WebKit::ChromeClientImpl; |
| 46 using WebKit::WebApplicationCacheHost; | 47 using WebKit::WebApplicationCacheHost; |
| 47 using WebKit::WebApplicationCacheHostClient; | 48 using WebKit::WebApplicationCacheHostClient; |
| 48 using WebKit::WebCookie; | 49 using WebKit::WebCookie; |
| 49 using WebKit::WebCursorInfo; | 50 using WebKit::WebCursorInfo; |
| 50 using WebKit::WebData; | 51 using WebKit::WebData; |
| 52 using WebKit::WebFrameImpl; |
| 51 using WebKit::WebLocalizedString; | 53 using WebKit::WebLocalizedString; |
| 52 using WebKit::WebPluginListBuilder; | 54 using WebKit::WebPluginListBuilder; |
| 53 using WebKit::WebStorageNamespace; | 55 using WebKit::WebStorageNamespace; |
| 54 using WebKit::WebString; | 56 using WebKit::WebString; |
| 55 using WebKit::WebSocketStreamHandle; | 57 using WebKit::WebSocketStreamHandle; |
| 56 using WebKit::WebThemeEngine; | 58 using WebKit::WebThemeEngine; |
| 57 using WebKit::WebURL; | 59 using WebKit::WebURL; |
| 58 using WebKit::WebURLLoader; | 60 using WebKit::WebURLLoader; |
| 59 using WebKit::WebVector; | 61 using WebKit::WebVector; |
| 62 using WebKit::WebViewImpl; |
| 60 using WebKit::WebWidgetClient; | 63 using WebKit::WebWidgetClient; |
| 61 using WebKit::WebWorkerClientImpl; | 64 using WebKit::WebWorkerClientImpl; |
| 62 | 65 |
| 63 namespace { | 66 namespace { |
| 64 | 67 |
| 65 ChromeClientImpl* ToChromeClient(WebCore::Widget* widget) { | 68 ChromeClientImpl* ToChromeClient(WebCore::Widget* widget) { |
| 66 WebCore::FrameView* view; | 69 WebCore::FrameView* view; |
| 67 if (widget->isFrameView()) { | 70 if (widget->isFrameView()) { |
| 68 view = static_cast<WebCore::FrameView*>(widget); | 71 view = static_cast<WebCore::FrameView*>(widget); |
| 69 } else if (widget->parent() && widget->parent()->isFrameView()) { | 72 } else if (widget->parent() && widget->parent()->isFrameView()) { |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 413 } |
| 411 | 414 |
| 412 //-------------------------------------------------------------------------- | 415 //-------------------------------------------------------------------------- |
| 413 | 416 |
| 414 // These are temporary methods that the WebKit layer can use to call to the | 417 // These are temporary methods that the WebKit layer can use to call to the |
| 415 // Glue layer. Once the Glue layer moves entirely into the WebKit layer, these | 418 // Glue layer. Once the Glue layer moves entirely into the WebKit layer, these |
| 416 // methods will be deleted. | 419 // methods will be deleted. |
| 417 | 420 |
| 418 WebKit::WebMediaPlayer* WebKitClientImpl::createWebMediaPlayer( | 421 WebKit::WebMediaPlayer* WebKitClientImpl::createWebMediaPlayer( |
| 419 WebKit::WebMediaPlayerClient* client, WebCore::Frame* frame) { | 422 WebKit::WebMediaPlayerClient* client, WebCore::Frame* frame) { |
| 420 WebFrameImpl* webframe = WebFrameImpl::FromFrame(frame); | 423 WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); |
| 421 if (!webframe->client()) | 424 if (!webframe->client()) |
| 422 return NULL; | 425 return NULL; |
| 423 | 426 |
| 424 return webframe->client()->createMediaPlayer(webframe, client); | 427 return webframe->client()->createMediaPlayer(webframe, client); |
| 425 } | 428 } |
| 426 | 429 |
| 427 void WebKitClientImpl::setCursorForPlugin( | 430 void WebKitClientImpl::setCursorForPlugin( |
| 428 const WebKit::WebCursorInfo& cursor_info, WebCore::Frame* frame) { | 431 const WebKit::WebCursorInfo& cursor_info, WebCore::Frame* frame) { |
| 429 WebCore::Page* page = frame->page(); | 432 WebCore::Page* page = frame->page(); |
| 430 if (!page) | 433 if (!page) |
| 431 return; | 434 return; |
| 432 | 435 |
| 433 ChromeClientImpl* chrome_client = | 436 ChromeClientImpl* chrome_client = |
| 434 static_cast<ChromeClientImpl*>(page->chrome()->client()); | 437 static_cast<ChromeClientImpl*>(page->chrome()->client()); |
| 435 | 438 |
| 436 // A windowless plugin can change the cursor in response to the WM_MOUSEMOVE | 439 // A windowless plugin can change the cursor in response to the WM_MOUSEMOVE |
| 437 // event. We need to reflect the changed cursor in the frame view as the | 440 // event. We need to reflect the changed cursor in the frame view as the |
| 438 // mouse is moved in the boundaries of the windowless plugin. | 441 // mouse is moved in the boundaries of the windowless plugin. |
| 439 chrome_client->setCursorForPlugin(cursor_info); | 442 chrome_client->setCursorForPlugin(cursor_info); |
| 440 } | 443 } |
| 441 | 444 |
| 442 void WebKitClientImpl::notifyJSOutOfMemory(WebCore::Frame* frame) { | 445 void WebKitClientImpl::notifyJSOutOfMemory(WebCore::Frame* frame) { |
| 443 if (!frame) | 446 if (!frame) |
| 444 return; | 447 return; |
| 445 | 448 |
| 446 WebFrameImpl* webframe = WebFrameImpl::FromFrame(frame); | 449 WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); |
| 447 if (!webframe->client()) | 450 if (!webframe->client()) |
| 448 return; | 451 return; |
| 449 webframe->client()->didExhaustMemoryAvailableForScript(webframe); | 452 webframe->client()->didExhaustMemoryAvailableForScript(webframe); |
| 450 } | 453 } |
| 451 | 454 |
| 452 bool WebKitClientImpl::popupsAllowed(NPP npp) { | 455 bool WebKitClientImpl::popupsAllowed(NPP npp) { |
| 453 bool popups_allowed = false; | 456 bool popups_allowed = false; |
| 454 if (npp) { | 457 if (npp) { |
| 455 NPAPI::PluginInstance* plugin_instance = | 458 NPAPI::PluginInstance* plugin_instance = |
| 456 reinterpret_cast<NPAPI::PluginInstance*>(npp->ndata); | 459 reinterpret_cast<NPAPI::PluginInstance*>(npp->ndata); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 return file_util::DirectoryExists(file_path); | 544 return file_util::DirectoryExists(file_path); |
| 542 } | 545 } |
| 543 | 546 |
| 544 WebKit::WebURL WebKitClientImpl::filePathToURL(const WebKit::WebString& path) { | 547 WebKit::WebURL WebKitClientImpl::filePathToURL(const WebKit::WebString& path) { |
| 545 FilePath file_path(webkit_glue::WebStringToFilePathString(path)); | 548 FilePath file_path(webkit_glue::WebStringToFilePathString(path)); |
| 546 GURL file_url = net::FilePathToFileURL(file_path); | 549 GURL file_url = net::FilePathToFileURL(file_path); |
| 547 return webkit_glue::KURLToWebURL(webkit_glue::GURLToKURL(file_url)); | 550 return webkit_glue::KURLToWebURL(webkit_glue::GURLToKURL(file_url)); |
| 548 } | 551 } |
| 549 | 552 |
| 550 } // namespace webkit_glue | 553 } // namespace webkit_glue |
| OLD | NEW |