2006-10-05 Marvin Decker <marv.decker@gmail.com>
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Oct 2006 20:22:47 +0000 (20:22 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Oct 2006 20:22:47 +0000 (20:22 +0000)
        Reviewed by Darin.

        http://bugs.webkit.org/show_bug.cgi?id=10989
        Provide a way for embedders to implement BrowserExtensionWin

WebCore:
        * WebCore.vcproj/WebCore/WebCore.vcproj:
        * bridge/win/BrowserExtensionWin.cpp: Added.
        (BrowserExtensionWin::BrowserExtensionWin):
        (BrowserExtensionWin::setTypedIconURL):
        (BrowserExtensionWin::setIconURL):
        (BrowserExtensionWin::getHistoryLength):
        (BrowserExtensionWin::canRunModal):
        (BrowserExtensionWin::createNewWindow):
        (BrowserExtensionWin::canRunModalNow):
        (BrowserExtensionWin::runModal):
        (BrowserExtensionWin::goBackOrForward):
        (BrowserExtensionWin::historyURL):
        * bridge/win/BrowserExtensionWin.h:
        * bridge/win/FrameWin.cpp:
        (WebCore::FrameWin::createNewWindow):
        * bridge/win/FrameWin.h:
        * platform/win/TemporaryLinkStubs.cpp:

WebKit:
        * COM/Interfaces/IWebUIDelegate.idl:
        * COM/WebFrame.cpp:
        (WebFrame::createNewWindow):
        * COM/WebFrame.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16817 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.vcproj/WebCore/WebCore.vcproj
WebCore/bridge/win/BrowserExtensionWin.cpp [new file with mode: 0644]
WebCore/bridge/win/BrowserExtensionWin.h
WebCore/bridge/win/FrameWin.cpp
WebCore/bridge/win/FrameWin.h
WebCore/platform/win/TemporaryLinkStubs.cpp
WebKit/COM/Interfaces/IWebUIDelegate.idl
WebKit/COM/WebFrame.cpp
WebKit/COM/WebFrame.h
WebKit/ChangeLog

index 41d34e43fee442229c209e2ab0640b5e93cce5d3..597d11f70408fdb6f3e757ca81a0b8b439644d76 100644 (file)
@@ -1,3 +1,28 @@
+2006-10-05  Marvin Decker  <marv.decker@gmail.com>
+
+        Reviewed by Darin.
+
+        http://bugs.webkit.org/show_bug.cgi?id=10989
+        Provide a way for embedders to implement BrowserExtensionWin
+
+        * WebCore.vcproj/WebCore/WebCore.vcproj:
+        * bridge/win/BrowserExtensionWin.cpp: Added.
+        (BrowserExtensionWin::BrowserExtensionWin):
+        (BrowserExtensionWin::setTypedIconURL):
+        (BrowserExtensionWin::setIconURL):
+        (BrowserExtensionWin::getHistoryLength):
+        (BrowserExtensionWin::canRunModal):
+        (BrowserExtensionWin::createNewWindow):
+        (BrowserExtensionWin::canRunModalNow):
+        (BrowserExtensionWin::runModal):
+        (BrowserExtensionWin::goBackOrForward):
+        (BrowserExtensionWin::historyURL):
+        * bridge/win/BrowserExtensionWin.h:
+        * bridge/win/FrameWin.cpp:
+        (WebCore::FrameWin::createNewWindow):
+        * bridge/win/FrameWin.h:
+        * platform/win/TemporaryLinkStubs.cpp:
+
 2006-10-05  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Darin.
index 364c079e532a2d53837d86de16c7a9f84438710d..1526e8d70216d1aefa3db601ee70b1f9aeb1ebba 100644 (file)
                        <Filter
                                Name="win"
                                >
+                               <File
+                                       RelativePath="..\..\bridge\win\BrowserExtensionWin.cpp"
+                                       >
+                               </File>
                                <File
                                        RelativePath="..\..\bridge\win\BrowserExtensionWin.h"
                                        >
diff --git a/WebCore/bridge/win/BrowserExtensionWin.cpp b/WebCore/bridge/win/BrowserExtensionWin.cpp
new file mode 100644 (file)
index 0000000..bc0e702
--- /dev/null
@@ -0,0 +1,73 @@
+#include <windows.h>
+#include "BrowserExtensionWin.h"
+#include "FrameWin.h"
+
+namespace WebCore {
+
+#define notImplemented() do { \
+    char buf[256] = {0}; \
+    _snprintf(buf, sizeof(buf), "FIXME: UNIMPLEMENTED: %s:%d\n", __FILE__, __LINE__); \
+    OutputDebugStringA(buf); \
+} while (0)
+
+
+BrowserExtensionWin::BrowserExtensionWin(WebCore::FrameWin* frame) : m_frame(frame)
+{
+
+}
+
+void BrowserExtensionWin::setTypedIconURL(KURL const&, const String&)
+{
+}
+
+void BrowserExtensionWin::setIconURL(KURL const&)
+{
+
+}
+
+int BrowserExtensionWin::getHistoryLength()
+{
+    return 0;
+}
+
+bool BrowserExtensionWin::canRunModal()
+{
+    notImplemented();
+    return 0;
+}
+
+void BrowserExtensionWin::createNewWindow(struct WebCore::ResourceRequest const& request)
+{
+    m_frame->createNewWindow(request);
+}
+
+void BrowserExtensionWin::createNewWindow(struct WebCore::ResourceRequest const& request,
+                                          struct WebCore::WindowArgs const& args,
+                                          Frame*& frame)
+{
+    m_frame->createNewWindow(request, args, frame);
+}
+
+bool BrowserExtensionWin::canRunModalNow()
+{
+    notImplemented();
+    return 0;
+}
+
+void BrowserExtensionWin::runModal()
+{
+    notImplemented();
+}
+
+void BrowserExtensionWin::goBackOrForward(int)
+{
+    notImplemented();
+}
+
+KURL BrowserExtensionWin::historyURL(int distance)
+{
+    notImplemented();
+    return KURL();
+}
+
+} // namespace WebCore
index 5deccd2394d5c84130467ec0960e0ccad6f93fa4..884e3fe8e337afc4787bd7f05bebe46b73861867 100644 (file)
 namespace WebCore {
 
 class Frame;
-class WinFrame;
+class FrameWin;
 
 class BrowserExtensionWin : public BrowserExtension {
 public:
-    BrowserExtensionWin(Frame*);
+    BrowserExtensionWin(FrameWin*);
  
     virtual void createNewWindow(const ResourceRequest&);
     virtual void createNewWindow(const ResourceRequest&,
@@ -51,7 +51,7 @@ public:
     virtual void runModal();
     
 private:
-     WinFrame *m_frame;
+     FrameWin *m_frame;
 };
 
 }
index ac0a846a7c4d9829bac1103c410c1f75272bb5fc..5d6beafec4aad5ddc96da307454f2e0f60797f1d 100644 (file)
@@ -150,5 +150,16 @@ void FrameWin::setStatusBarText(const String& status)
     m_client->setStatusText(text);
 }
 
+void FrameWin::createNewWindow(const ResourceRequest& request)
+{
+    m_client->createNewWindow(request);
+}
+
+void FrameWin::createNewWindow(const ResourceRequest& request,
+                               const WindowArgs& args,
+                               Frame*& part)
+{
+    m_client->createNewWindow(request, args, part);
+}
 
 }
index 7fca39e3d5c49f2b2f88399c24c011a9c9cb5e27..0e392f8f63f96321d9a62db8f2e59d7e76282f13 100644 (file)
@@ -33,6 +33,10 @@ namespace WebCore {
 class FrameWinClient
 {
 public:
+    virtual void createNewWindow(const ResourceRequest&) = 0;
+    virtual void createNewWindow(const ResourceRequest&,
+                                 const WindowArgs&,
+                                 Frame*& part) = 0;
     virtual void openURL(const DeprecatedString&, bool lockHistory) = 0;
     virtual void submitForm(const String& method, const KURL&, const FormData*) = 0;
     virtual void setTitle(const String& title) = 0;
@@ -45,6 +49,8 @@ public:
     FrameWin(Page*, Element*, FrameWinClient*);
     ~FrameWin();
 
+    virtual void createNewWindow(const ResourceRequest&);
+    virtual void createNewWindow(const ResourceRequest&, const WindowArgs&, Frame*& part);
     virtual bool openURL(const KURL&);
     virtual void openURLRequest(const ResourceRequest&);
     virtual void submitForm(const ResourceRequest&);
index 10b111ecc553aea5636cd697808490010d48c3c2..8e68ac6377ec75a6eee90c3813d5cd1950bd1514 100644 (file)
@@ -58,7 +58,6 @@
 #include "PlugInInfoStore.h"
 #include "RenderTheme.h"
 #include "FrameWin.h"
-#include "BrowserExtensionWin.h"
 #include "ResourceLoader.h"
 #include "RenderThemeWin.h"
 #include "TextBoundaries.h"
@@ -193,14 +192,6 @@ void FrameWin::issuePasteAndMatchStyleCommand() { notImplemented(); }
 KURL FrameWin::originalRequestURL() const { return KURL(); }
 bool FrameWin::isLoadTypeReload() { notImplemented(); return false; }
 
-bool BrowserExtensionWin::canRunModal() { notImplemented(); return 0; }
-void BrowserExtensionWin::createNewWindow(struct WebCore::ResourceRequest const&,struct WebCore::WindowArgs const&,Frame*&) { notImplemented(); }
-bool BrowserExtensionWin::canRunModalNow() { notImplemented(); return 0; }
-void BrowserExtensionWin::runModal() { notImplemented(); }
-void BrowserExtensionWin::goBackOrForward(int) { notImplemented(); }
-KURL BrowserExtensionWin::historyURL(int distance) { notImplemented(); return KURL(); }
-void BrowserExtensionWin::createNewWindow(struct WebCore::ResourceRequest const&) { notImplemented(); }
-
 void GraphicsContext::addRoundedRectClip(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight,
     const IntSize& bottomLeft, const IntSize& bottomRight) { notImplemented(); }
 void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness) { notImplemented(); }
@@ -256,11 +247,6 @@ void FrameWin::handledOnloadEvents() { }
 Plugin* FrameWin::createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&) { return 0; }
 ObjectContentType FrameWin::objectContentType(const KURL&, const String&) { return ObjectContentNone; }
 
-BrowserExtensionWin::BrowserExtensionWin(WebCore::Frame*) { }
-void BrowserExtensionWin::setTypedIconURL(KURL const&, const String&) { }
-void BrowserExtensionWin::setIconURL(KURL const&) { }
-int BrowserExtensionWin::getHistoryLength() { return 0; }
-
 namespace WebCore {
 
 bool CheckIfReloading(WebCore::DocLoader*) { return false; }
index 76f879089cdd7254b62754dba681e229638fa938..37ddbb60ad950a07ff1f2363671826ddc562787f 100644 (file)
@@ -189,7 +189,7 @@ interface IWebUIDelegate : IUnknown
         @result The WebView for the new window.
         - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request;
     */
-    HRESULT createWebViewWithRequest([in] IWebView* sender, [in] IWebURLRequest* request, [out, retval] IWebView* newWebView);
+    HRESULT createWebViewWithRequest([in] IWebView* sender, [in] IWebURLRequest* request, [out, retval] IWebView** newWebView);
 
     /*!
         @method webViewShow:
index 6fb7c7e4e903462b1c3b165bb055d019faa627ca..2d67a3ab24f73cb466ce1d68565dd69395e122bf 100644 (file)
@@ -554,6 +554,35 @@ void WebFrame::receivedAllData(ResourceLoader* job, PlatformData data)
 
 // FrameWinClient
 
+void WebFrame::createNewWindow(const WebCore::ResourceRequest&)
+{
+    // FIXME: This seems to never get called. Is it necessary?
+    IWebUIDelegate* uiDelegate = NULL;
+    if (FAILED(d->webView->uiDelegate(&uiDelegate)) || !uiDelegate)
+        return;
+    IWebView* new_view = NULL;
+    uiDelegate->createWebViewWithRequest(d->webView, NULL, &new_view);
+}
+
+void WebFrame::createNewWindow(const WebCore::ResourceRequest&,
+                               const WebCore::WindowArgs&,
+                               WebCore::Frame*& part)
+{
+    IWebUIDelegate* uiDelegate = NULL;
+    if (FAILED(d->webView->uiDelegate(&uiDelegate)) || !uiDelegate)
+        return;
+    IWebView* new_view = NULL;
+    if (FAILED(uiDelegate->createWebViewWithRequest(d->webView, NULL, &new_view)) || !new_view)
+        return;
+
+    IWebFrame* new_iwebframe = NULL;
+    if (FAILED(new_view->mainFrame(&new_iwebframe)) || !new_iwebframe)
+      return;
+
+    WebFrame* new_frame = static_cast<WebFrame*>(new_iwebframe);
+    part = new_frame->d->frame.get();
+}
+
 void WebFrame::openURL(const DeprecatedString& url, bool lockHistory)
 {
     DeprecatedString terminatedURL(url);
index c9acb34047ea746e68af42c11de1a4b62bef9f1b..6e8949b2fecfba4666388ff3a1631202a8fdbc1b 100644 (file)
@@ -137,6 +137,10 @@ public:
     virtual void receivedAllData(WebCore::ResourceLoader*, WebCore::PlatformData);
 
     // FrameWinClient
+    virtual void createNewWindow(const WebCore::ResourceRequest&);
+    virtual void createNewWindow(const WebCore::ResourceRequest&,
+                                 const WebCore::WindowArgs&,
+                                 WebCore::Frame*& part);
     virtual void openURL(const WebCore::DeprecatedString&, bool lockHistory);
     virtual void submitForm(const WebCore::String& method, const WebCore::KURL&, const WebCore::FormData*);
     virtual void setTitle(const WebCore::String& title);
index 7dbb6d803bb15a44dbc5b8b156a4d81fe11b6a8f..bf059e6d5772e19c01bd6fb5161c82f0e765c65e 100644 (file)
@@ -1,3 +1,15 @@
+2006-10-05  Marvin Decker  <marv.decker@gmail.com>
+
+        Reviewed by Darin.
+
+        http://bugs.webkit.org/show_bug.cgi?id=10989
+        Provide a way for embedders to implement BrowserExtensionWin
+
+        * COM/Interfaces/IWebUIDelegate.idl:
+        * COM/WebFrame.cpp:
+        (WebFrame::createNewWindow):
+        * COM/WebFrame.h:
+
 2006-10-04  Mark Rowe  <bdash@webkit.org>
 
         Reviewed by NOBODY (build fix).