summaryrefslogtreecommitdiffstats
path: root/WebKit/win/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/win/WebCoreSupport')
-rw-r--r--WebKit/win/WebCoreSupport/WebChromeClient.cpp91
-rw-r--r--WebKit/win/WebCoreSupport/WebChromeClient.h13
-rw-r--r--WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp204
-rw-r--r--WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h57
-rw-r--r--WebKit/win/WebCoreSupport/WebDragClient.cpp20
-rw-r--r--WebKit/win/WebCoreSupport/WebEditorClient.cpp6
-rw-r--r--WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp52
-rw-r--r--WebKit/win/WebCoreSupport/WebFrameLoaderClient.h4
-rw-r--r--WebKit/win/WebCoreSupport/WebInspectorClient.cpp11
-rw-r--r--WebKit/win/WebCoreSupport/WebInspectorDelegate.h3
-rw-r--r--WebKit/win/WebCoreSupport/WebPluginHalterClient.cpp58
-rw-r--r--WebKit/win/WebCoreSupport/WebPluginHalterClient.h47
12 files changed, 520 insertions, 46 deletions
diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/WebKit/win/WebCoreSupport/WebChromeClient.cpp
index 1c0401f..5d39452 100644
--- a/WebKit/win/WebCoreSupport/WebChromeClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebChromeClient.cpp
@@ -26,10 +26,13 @@
#include "config.h"
#include "WebChromeClient.h"
+#include "COMPropertyBag.h"
+#include "COMVariantSetter.h"
#include "WebElementPropertyBag.h"
#include "WebFrame.h"
#include "WebHistory.h"
#include "WebMutableURLRequest.h"
+#include "WebDesktopNotificationsDelegate.h"
#include "WebSecurityOrigin.h"
#include "WebView.h"
#pragma warning(push, 0)
@@ -58,6 +61,9 @@ static const size_t maxFilePathsListSize = USHRT_MAX;
WebChromeClient::WebChromeClient(WebView* webView)
: m_webView(webView)
+#if ENABLE(NOTIFICATIONS)
+ , m_notificationsDelegate(new WebDesktopNotificationsDelegate(webView))
+#endif
{
}
@@ -150,35 +156,59 @@ void WebChromeClient::takeFocus(FocusDirection direction)
}
}
+static COMPtr<IPropertyBag> createWindowFeaturesPropertyBag(const WindowFeatures& features)
+{
+ HashMap<String, COMVariant> map;
+ if (features.xSet)
+ map.set(WebWindowFeaturesXKey, features.x);
+ if (features.ySet)
+ map.set(WebWindowFeaturesYKey, features.y);
+ if (features.widthSet)
+ map.set(WebWindowFeaturesWidthKey, features.width);
+ if (features.heightSet)
+ map.set(WebWindowFeaturesHeightKey, features.height);
+ map.set(WebWindowFeaturesMenuBarVisibleKey, features.menuBarVisible);
+ map.set(WebWindowFeaturesStatusBarVisibleKey, features.statusBarVisible);
+ map.set(WebWindowFeaturesToolBarVisibleKey, features.toolBarVisible);
+ map.set(WebWindowFeaturesScrollbarsVisibleKey, features.scrollbarsVisible);
+ map.set(WebWindowFeaturesResizableKey, features.resizable);
+ map.set(WebWindowFeaturesFullscreenKey, features.fullscreen);
+ map.set(WebWindowFeaturesDialogKey, features.dialog);
+
+ return COMPtr<IPropertyBag>(AdoptCOM, COMPropertyBag<COMVariant>::adopt(map));
+}
+
Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest& frameLoadRequest, const WindowFeatures& features)
{
- if (features.dialog) {
- COMPtr<IWebUIDelegate> delegate = uiDelegate();
- if (!delegate)
- return 0;
- COMPtr<IWebMutableURLRequest> request(AdoptCOM, WebMutableURLRequest::createInstance(frameLoadRequest.resourceRequest()));
- COMPtr<IWebView> dialog;
- if (FAILED(delegate->createModalDialog(m_webView, request.get(), &dialog)))
+ COMPtr<IWebUIDelegate> delegate = uiDelegate();
+ if (!delegate)
+ return 0;
+
+ COMPtr<IWebMutableURLRequest> request(AdoptCOM, WebMutableURLRequest::createInstance(frameLoadRequest.resourceRequest()));
+
+ COMPtr<IWebUIDelegatePrivate2> delegatePrivate(Query, delegate);
+ if (delegatePrivate) {
+ COMPtr<IWebView> newWebView;
+ HRESULT hr = delegatePrivate->createWebViewWithRequest(m_webView, request.get(), createWindowFeaturesPropertyBag(features).get(), &newWebView);
+
+ if (SUCCEEDED(hr) && newWebView)
+ return core(newWebView.get());
+
+ // If the delegate doesn't implement the IWebUIDelegatePrivate2 version of the call, fall back
+ // to the old versions (even if they support the IWebUIDelegatePrivate2 interface).
+ if (hr != E_NOTIMPL)
return 0;
- return core(dialog.get());
}
- Page* page = 0;
- IWebUIDelegate* uiDelegate = 0;
- IWebMutableURLRequest* request = WebMutableURLRequest::createInstance(frameLoadRequest.resourceRequest());
+ COMPtr<IWebView> newWebView;
- if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
- IWebView* webView = 0;
- if (SUCCEEDED(uiDelegate->createWebViewWithRequest(m_webView, request, &webView))) {
- page = core(webView);
- webView->Release();
- }
-
- uiDelegate->Release();
- }
+ if (features.dialog) {
+ if (FAILED(delegate->createModalDialog(m_webView, request.get(), &newWebView)))
+ return 0;
+ } else if (FAILED(delegate->createWebViewWithRequest(m_webView, request.get(), &newWebView)))
+ return 0;
- request->Release();
- return page;
+ return newWebView ? core(newWebView.get()) : 0;
}
void WebChromeClient::show()
@@ -411,20 +441,7 @@ bool WebChromeClient::tabsToLinks() const
IntRect WebChromeClient::windowResizerRect() const
{
- IntRect intRect;
-
- IWebUIDelegate* ui;
- if (SUCCEEDED(m_webView->uiDelegate(&ui)) && ui) {
- IWebUIDelegatePrivate* uiPrivate;
- if (SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegatePrivate, (void**)&uiPrivate))) {
- RECT r;
- if (SUCCEEDED(uiPrivate->webViewResizerRect(m_webView, &r)))
- intRect = IntRect(r.left, r.top, r.right-r.left, r.bottom-r.top);
- uiPrivate->Release();
- }
- ui->Release();
- }
- return intRect;
+ return IntRect();
}
void WebChromeClient::repaint(const IntRect& windowRect, bool contentChanged, bool immediate, bool repaintContentOnly)
@@ -469,7 +486,7 @@ IntPoint WebChromeClient::screenToWindow(const IntPoint& point) const
return result;
}
-PlatformWidget WebChromeClient::platformWindow() const
+PlatformPageClient WebChromeClient::platformPageClient() const
{
HWND viewWindow;
if (FAILED(m_webView->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))))
diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.h b/WebKit/win/WebCoreSupport/WebChromeClient.h
index c601c8e..d01e47d 100644
--- a/WebKit/win/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/win/WebCoreSupport/WebChromeClient.h
@@ -29,8 +29,10 @@
#include <WebCore/FocusDirection.h>
#include <WebCore/ScrollTypes.h>
#include <wtf/Forward.h>
+#include <wtf/PassRefPtr.h>
class WebView;
+class WebDesktopNotificationsDelegate;
interface IWebUIDelegate;
@@ -93,9 +95,10 @@ public:
virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect);
virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint& p) const;
virtual WebCore::IntRect windowToScreen(const WebCore::IntRect& r) const;
- virtual PlatformWidget platformWindow() const;
+ virtual PlatformPageClient platformPageClient() const;
virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const;
+ virtual void scrollbarsModeDidChange() const { }
virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
virtual void setToolTip(const WebCore::String&, WebCore::TextDirection);
@@ -131,8 +134,16 @@ public:
virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
+#if ENABLE(NOTIFICATIONS)
+ virtual WebCore::NotificationPresenter* notificationPresenter() const { return reinterpret_cast<WebCore::NotificationPresenter*>(m_notificationsDelegate.get()); }
+#endif
+
private:
COMPtr<IWebUIDelegate> uiDelegate();
WebView* m_webView;
+
+#if ENABLE(NOTIFICATIONS)
+ OwnPtr<WebDesktopNotificationsDelegate> m_notificationsDelegate;
+#endif
};
diff --git a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
new file mode 100644
index 0000000..f822bfe
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebDesktopNotificationsDelegate.h"
+#include "WebSecurityOrigin.h"
+#include "WebView.h"
+#include <WebCore/BString.h>
+
+#if ENABLE(NOTIFICATIONS)
+
+using namespace WebCore;
+
+class NotificationCOMWrapper : public IWebDesktopNotification {
+public:
+ static NotificationCOMWrapper* create(Notification* inner) { return new NotificationCOMWrapper(inner); }
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ // IWebDesktopNotification
+ HRESULT STDMETHODCALLTYPE isHTML(BOOL* result);
+ HRESULT STDMETHODCALLTYPE contentsURL(BSTR* result);
+ HRESULT STDMETHODCALLTYPE iconURL(BSTR* result);
+ HRESULT STDMETHODCALLTYPE title(BSTR* result);
+ HRESULT STDMETHODCALLTYPE text(BSTR* result);
+ HRESULT STDMETHODCALLTYPE notifyDisplay();
+ HRESULT STDMETHODCALLTYPE notifyError();
+ HRESULT STDMETHODCALLTYPE notifyClose(BOOL xplicit);
+
+private:
+ NotificationCOMWrapper(Notification* inner) : m_refCount(1), m_inner(inner) {}
+
+ int m_refCount;
+ Notification* m_inner;
+};
+
+HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<NotificationCOMWrapper*>(this);
+ else if (IsEqualGUID(riid, IID_IWebDesktopNotification))
+ *ppvObject = static_cast<NotificationCOMWrapper*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE NotificationCOMWrapper::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE NotificationCOMWrapper::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+ return newRef;
+}
+
+HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::isHTML(BOOL* result)
+{
+ *result = m_inner->isHTML();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::contentsURL(BSTR* result)
+{
+ *result = BString(m_inner->url()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::iconURL(BSTR* result)
+{
+ *result = BString(m_inner->contents().icon()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::title(BSTR* result)
+{
+ *result = BString(m_inner->contents().title()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::text(BSTR* result)
+{
+ *result = BString(m_inner->contents().body()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::notifyDisplay()
+{
+ m_inner->dispatchDisplayEvent();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::notifyError()
+{
+ m_inner->dispatchErrorEvent();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::notifyClose(BOOL xplicit)
+{
+ m_inner->dispatchCloseEvent();
+ return S_OK;
+}
+
+WebDesktopNotificationsDelegate::WebDesktopNotificationsDelegate(WebView* webView)
+ : m_webView(webView)
+{
+}
+
+bool WebDesktopNotificationsDelegate::show(Notification* object)
+{
+ if (hasNotificationDelegate())
+ notificationDelegate()->showDesktopNotification(NotificationCOMWrapper::create(object));
+ return true;
+}
+
+void WebDesktopNotificationsDelegate::cancel(Notification* object)
+{
+ if (hasNotificationDelegate())
+ notificationDelegate()->cancelDesktopNotification(NotificationCOMWrapper::create(object));
+}
+
+void WebDesktopNotificationsDelegate::notificationObjectDestroyed(Notification* object)
+{
+ if (hasNotificationDelegate())
+ notificationDelegate()->notificationDestroyed(NotificationCOMWrapper::create(object));
+}
+
+void WebDesktopNotificationsDelegate::requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback)
+{
+ BString org(origin->toString());
+ if (hasNotificationDelegate())
+ notificationDelegate()->requestNotificationPermission(org);
+}
+
+NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(SecurityOrigin* origin)
+{
+ int out = 0;
+ BString org(origin->toString());
+ if (hasNotificationDelegate())
+ notificationDelegate()->checkNotificationPermission(org, &out);
+ return (NotificationPresenter::Permission) out;
+}
+
+bool WebDesktopNotificationsDelegate::hasNotificationDelegate()
+{
+ COMPtr<IWebUIDelegate> ui;
+ m_webView->uiDelegate(&ui);
+
+ COMPtr<IWebUIDelegate2> ui2;
+ return SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegate2, (void**) &ui2));
+}
+
+COMPtr<IWebDesktopNotificationsDelegate> WebDesktopNotificationsDelegate::notificationDelegate()
+{
+ COMPtr<IWebUIDelegate> ui;
+ m_webView->uiDelegate(&ui);
+
+ COMPtr<IWebUIDelegate2> ui2;
+ COMPtr<IWebDesktopNotificationsDelegate> delegate;
+ if (SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegate2, (void**) &ui2)))
+ ui2->desktopNotificationsDelegate(&delegate);
+
+ return delegate;
+}
+
+#endif // ENABLE(NOTIFICATIONS)
diff --git a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
new file mode 100644
index 0000000..00c00d5
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <WebCore/COMPtr.h>
+#include <WebCore/Notification.h>
+#include <WebCore/NotificationPresenter.h>
+
+#if ENABLE(NOTIFICATIONS)
+
+interface IWebDesktopNotificationPresenter;
+
+class WebDesktopNotificationsDelegate : public WebCore::NotificationPresenter {
+public:
+ WebDesktopNotificationsDelegate(WebView* view);
+
+ /* WebCore::NotificationPresenter interface */
+ virtual bool show(WebCore::Notification* object);
+ virtual void cancel(WebCore::Notification* object);
+ virtual void notificationObjectDestroyed(WebCore::Notification* object);
+ virtual void requestPermission(WebCore::SecurityOrigin* origin, PassRefPtr<WebCore::VoidCallback> callback);
+ virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::SecurityOrigin* origin);
+
+private:
+ bool hasNotificationDelegate();
+ COMPtr<IWebDesktopNotificationsDelegate> notificationDelegate();
+
+ WebView* m_webView;
+};
+
+#endif
diff --git a/WebKit/win/WebCoreSupport/WebDragClient.cpp b/WebKit/win/WebCoreSupport/WebDragClient.cpp
index e5c5a20..840fca1 100644
--- a/WebKit/win/WebCoreSupport/WebDragClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebDragClient.cpp
@@ -33,6 +33,7 @@
#pragma warning(push, 0)
#include <WebCore/ClipboardWin.h>
+#include <WebCore/DragController.h>
#include <WebCore/DragData.h>
#include <WebCore/Font.h>
#include <WebCore/FontDescription.h>
@@ -68,6 +69,22 @@ namespace WebCore {
using namespace WebCore;
+static DWORD draggingSourceOperationMaskToDragCursors(DragOperation op)
+{
+ DWORD result = DROPEFFECT_NONE;
+ if (op == DragOperationEvery)
+ return DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE;
+ if (op & DragOperationCopy)
+ result |= DROPEFFECT_COPY;
+ if (op & DragOperationLink)
+ result |= DROPEFFECT_LINK;
+ if (op & DragOperationMove)
+ result |= DROPEFFECT_MOVE;
+ if (op & DragOperationGeneric)
+ result |= DROPEFFECT_MOVE;
+ return result;
+}
+
WebDragClient::WebDragClient(WebView* webView)
: m_webView(webView)
{
@@ -154,8 +171,7 @@ void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, c
}
}
- //FIXME: Ensure correct drag ops are available <rdar://problem/5015957>
- DWORD okEffect = DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE;
+ DWORD okEffect = draggingSourceOperationMaskToDragCursors(m_webView->page()->dragController()->sourceDragOperation());
DWORD effect;
COMPtr<IWebUIDelegate> ui;
if (SUCCEEDED(m_webView->uiDelegate(&ui))) {
diff --git a/WebKit/win/WebCoreSupport/WebEditorClient.cpp b/WebKit/win/WebCoreSupport/WebEditorClient.cpp
index e626178..c9118e5 100644
--- a/WebKit/win/WebCoreSupport/WebEditorClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebEditorClient.cpp
@@ -29,6 +29,8 @@
#include "WebKit.h"
#include "WebLocalizableStrings.h"
+#include "WebNotification.h"
+#include "WebNotificationCenter.h"
#include "WebView.h"
#include "DOMCoreClasses.h"
#pragma warning(push, 0)
@@ -209,6 +211,10 @@ void WebEditorClient::respondToChangedContents()
void WebEditorClient::respondToChangedSelection()
{
m_webView->selectionChanged();
+
+ static BSTR webViewDidChangeSelectionNotificationName = SysAllocString(WebViewDidChangeSelectionNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(webViewDidChangeSelectionNotificationName, static_cast<IWebView*>(m_webView), 0);
}
void WebEditorClient::didEndEditing()
diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
index 0fea348..1281420 100644
--- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -44,6 +44,7 @@
#include "WebHistoryItem.h"
#include "WebMutableURLRequest.h"
#include "WebNotificationCenter.h"
+#include "WebSecurityOrigin.h"
#include "WebURLAuthenticationChallenge.h"
#include "WebURLResponse.h"
#include "WebView.h"
@@ -529,6 +530,36 @@ bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const
return true;
}
+void WebFrameLoaderClient::didDisplayInsecureContent()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv;
+ if (FAILED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) || !frameLoadDelegatePriv)
+ return;
+
+ COMPtr<IWebFrameLoadDelegatePrivate2> frameLoadDelegatePriv2(Query, frameLoadDelegatePriv);
+ if (!frameLoadDelegatePriv2)
+ return;
+
+ frameLoadDelegatePriv2->didDisplayInsecureContent(webView);
+}
+
+void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin* origin)
+{
+ COMPtr<IWebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createInstance(origin);
+
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv;
+ if (FAILED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) || !frameLoadDelegatePriv)
+ return;
+
+ COMPtr<IWebFrameLoadDelegatePrivate2> frameLoadDelegatePriv2(Query, frameLoadDelegatePriv);
+ if (!frameLoadDelegatePriv2)
+ return;
+
+ frameLoadDelegatePriv2->didRunInsecureContent(webView, webSecurityOrigin.get());
+}
+
PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
{
RefPtr<WebDocumentLoader> loader = WebDocumentLoader::create(request, substituteData);
@@ -764,3 +795,24 @@ bool WebFrameLoaderClient::shouldUsePluginDocument(const String& mimeType) const
return webView->shouldUseEmbeddedView(mimeType);
}
+
+bool WebFrameLoaderClient::shouldLoadMediaElementURL(const KURL& url) const
+{
+ WebView* webView = m_webFrame->webView();
+ if (!webView)
+ return true;
+
+ COMPtr<IWebPolicyDelegate> policyDelegate;
+ if (FAILED(webView->policyDelegate(&policyDelegate)) || !policyDelegate)
+ return true;
+
+ COMPtr<IWebPolicyDelegatePrivate> policyDelegatePrivate(Query, policyDelegate);
+ if (!policyDelegatePrivate)
+ return true;
+
+ BOOL retval;
+ if (FAILED(policyDelegatePrivate->shouldLoadMediaURL(webView, BString(url), m_webFrame, &retval)))
+ return true;
+
+ return retval;
+}
diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
index ef7e982..a215cf9 100644
--- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
+++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
@@ -92,6 +92,9 @@ public:
virtual void updateGlobalHistoryRedirectLinks();
virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
+ virtual void didDisplayInsecureContent();
+ virtual void didRunInsecureContent(WebCore::SecurityOrigin*);
+
virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
virtual void setTitle(const WebCore::String& title, const WebCore::KURL&);
@@ -109,6 +112,7 @@ public:
virtual bool shouldUsePluginDocument(const WebCore::String& mimeType) const;
virtual void dispatchDidFailToStartPlugin(const WebCore::PluginView*) const;
+ virtual bool shouldLoadMediaElementURL(const WebCore::KURL&) const;
protected:
WebFrameLoaderClient(WebFrame*);
diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
index ba724b4..75a76f2 100644
--- a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
@@ -99,13 +99,11 @@ void WebInspectorClient::inspectorDestroyed()
Page* WebInspectorClient::createPage()
{
- if (m_webView)
- return core(m_webView.get());
-
- ASSERT(!m_hwnd);
-
registerWindowClass();
+ if (m_hwnd)
+ ::DestroyWindow(m_hwnd);
+
m_hwnd = ::CreateWindowEx(0, kWebInspectorWindowClassName, 0, WS_OVERLAPPEDWINDOW,
defaultWindowRect().x(), defaultWindowRect().y(), defaultWindowRect().width(), defaultWindowRect().height(),
0, 0, 0, 0);
@@ -351,8 +349,9 @@ void WebInspectorClient::showWindowWithoutNotifications()
ASSERT(m_webView);
ASSERT(m_inspectedWebViewHwnd);
+ // If no preference is set - default to an attached window. This is important for inspector LayoutTests.
InspectorController::Setting shouldAttach = m_inspectedWebView->page()->inspectorController()->setting(inspectorStartsAttachedName);
- m_shouldAttachWhenShown = shouldAttach.type() == InspectorController::Setting::BooleanType ? shouldAttach.booleanValue() : false;
+ m_shouldAttachWhenShown = shouldAttach.type() == InspectorController::Setting::BooleanType ? shouldAttach.booleanValue() : true;
if (!m_shouldAttachWhenShown) {
// Put the Inspector's WebView inside our window and show it.
diff --git a/WebKit/win/WebCoreSupport/WebInspectorDelegate.h b/WebKit/win/WebCoreSupport/WebInspectorDelegate.h
index 85f14b2..7561d5a 100644
--- a/WebKit/win/WebCoreSupport/WebInspectorDelegate.h
+++ b/WebKit/win/WebCoreSupport/WebInspectorDelegate.h
@@ -324,6 +324,9 @@ public:
/* [in] */ HDC hDC,
/* [in] */ RECT rect) { return E_NOTIMPL; }
+ virtual HRESULT STDMETHODCALLTYPE desktopNotificationsDelegate(
+ /* [retval][out] */ IWebDesktopNotificationsDelegate **result) { return E_NOTIMPL; }
+
private:
WebInspectorDelegate();
diff --git a/WebKit/win/WebCoreSupport/WebPluginHalterClient.cpp b/WebKit/win/WebCoreSupport/WebPluginHalterClient.cpp
new file mode 100644
index 0000000..aef313b
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebPluginHalterClient.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "WebPluginHalterClient.h"
+
+#include "DOMCoreClasses.h"
+#include "WebView.h"
+#include <WebCore/Node.h>
+#include <wtf/Assertions.h>
+
+using WebCore::Node;
+
+WebPluginHalterClient::WebPluginHalterClient(WebView* webView)
+ : m_webView(webView)
+{
+ ASSERT_ARG(webView, webView);
+}
+
+bool WebPluginHalterClient::shouldHaltPlugin(WebCore::Node* n) const
+{
+ ASSERT_ARG(n, n);
+
+ IWebPluginHalterDelegate* d;
+ if (FAILED(m_webView->pluginHalterDelegate(&d)) || !d)
+ return false;
+
+ COMPtr<IDOMNode> domNode(AdoptCOM, DOMNode::createInstance(n));
+
+ BOOL shouldHalt;
+ if (FAILED(d->shouldHaltPlugin(m_webView, domNode.get(), &shouldHalt)))
+ return false;
+
+ return shouldHalt;
+}
diff --git a/WebKit/win/WebCoreSupport/WebPluginHalterClient.h b/WebKit/win/WebCoreSupport/WebPluginHalterClient.h
new file mode 100644
index 0000000..1752444
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebPluginHalterClient.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebPluginHalterClient_h
+#define WebPluginHalterClient_h
+
+#include <WebCore/PluginHalterClient.h>
+
+namespace WebCore {
+ class Node;
+}
+
+class WebView;
+
+class WebPluginHalterClient : public WebCore::PluginHalterClient {
+public:
+ WebPluginHalterClient(WebView* webView);
+
+ virtual bool shouldHaltPlugin(WebCore::Node* n) const;
+
+private:
+ WebView* m_webView;
+};
+
+#endif // WebPluginHalterClient_h