WebCore:

        Reviewed by Maciej and Steve.

        fixed <rdar://4982432> window.print() needs to be implemented

        * bridge/win/FrameWin.cpp:
        (WebCore::Frame::print):
        * page/Chrome.cpp:
        (WebCore::Chrome::print):
        * page/Chrome.h:
        * page/ChromeClient.h:
        * platform/win/TemporaryLinkStubs.cpp:

win:

        Reviewed by Maciej and Steve.

        fixed <rdar://4982432> window.print() needs to be implemented

        * Interfaces/IWebUIDelegate.idl:
        * WebChromeClient.cpp:
        (WebChromeClient::print):
        * WebChromeClient.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@24252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 267dafb..c82d57c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2007-07-12  Alice Liu  <alice.liu@apple.com>
+
+        Reviewed by Maciej and Steve.
+
+        fixed <rdar://4982432> window.print() needs to be implemented
+
+        * bridge/win/FrameWin.cpp:
+        (WebCore::Frame::print):
+        * page/Chrome.cpp:
+        (WebCore::Chrome::print):
+        * page/Chrome.h:
+        * page/ChromeClient.h:
+        * platform/win/TemporaryLinkStubs.cpp:
+
 2007-07-11  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by Harrison.
diff --git a/WebCore/bridge/win/FrameWin.cpp b/WebCore/bridge/win/FrameWin.cpp
index f830ea1..8fb47e3 100644
--- a/WebCore/bridge/win/FrameWin.cpp
+++ b/WebCore/bridge/win/FrameWin.cpp
@@ -191,4 +191,10 @@
 {
 }
 
+void Frame::print()
+{
+    if (d->m_page)
+        d->m_page->chrome()->print();
+}
+
 } // namespace WebCore
diff --git a/WebCore/page/Chrome.cpp b/WebCore/page/Chrome.cpp
index 515405c..932a867 100644
--- a/WebCore/page/Chrome.cpp
+++ b/WebCore/page/Chrome.cpp
@@ -335,6 +335,11 @@
     m_client->setToolTip(toolTip);
 }
 
+void Chrome::print()
+{
+    m_client->print();
+}
+
 PageGroupLoadDeferrer::PageGroupLoadDeferrer(Page* page, bool deferSelf)
 {
     if (const HashSet<Page*>* group = page->frameNamespace()) {
diff --git a/WebCore/page/Chrome.h b/WebCore/page/Chrome.h
index ffc2955..d2fafcf 100644
--- a/WebCore/page/Chrome.h
+++ b/WebCore/page/Chrome.h
@@ -123,6 +123,8 @@
 
         void setToolTip(const HitTestResult&);
 
+        void print();
+
 #if PLATFORM(MAC)
         void focusNSView(NSView*);
 #endif
diff --git a/WebCore/page/ChromeClient.h b/WebCore/page/ChromeClient.h
index e69b0fa..370a1dc 100644
--- a/WebCore/page/ChromeClient.h
+++ b/WebCore/page/ChromeClient.h
@@ -100,6 +100,8 @@
         virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags) = 0;
 
         virtual void setToolTip(const String&) = 0;
+
+        virtual void print() = 0;
 };
 
 }
diff --git a/WebCore/platform/win/TemporaryLinkStubs.cpp b/WebCore/platform/win/TemporaryLinkStubs.cpp
index 5854312..135cb01 100644
--- a/WebCore/platform/win/TemporaryLinkStubs.cpp
+++ b/WebCore/platform/win/TemporaryLinkStubs.cpp
@@ -76,7 +76,6 @@
 
 using namespace WebCore;
 
-void Frame::print() { notImplemented(); }
 void Frame::issueTransposeCommand() { notImplemented(); }
 
 void GraphicsContextPlatformPrivate::clip(const Path&) { notImplemented(); }
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index db88416..d40f8ba 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,14 @@
+2007-07-12  Alice Liu  <alice.liu@apple.com>
+
+        Reviewed by Maciej and Steve.
+
+        fixed <rdar://4982432> window.print() needs to be implemented
+
+        * Interfaces/IWebUIDelegate.idl:
+        * WebChromeClient.cpp:
+        (WebChromeClient::print):
+        * WebChromeClient.h:
+
 2007-07-11  Steve Falkenburg  <sfalken@apple.com>
 
         Static analysis build fix.
diff --git a/WebKit/win/Interfaces/IWebUIDelegate.idl b/WebKit/win/Interfaces/IWebUIDelegate.idl
index 8097e12..93b36b2 100644
--- a/WebKit/win/Interfaces/IWebUIDelegate.idl
+++ b/WebKit/win/Interfaces/IWebUIDelegate.idl
@@ -703,3 +703,24 @@
     */
     HRESULT canRedo([out, retval] BOOL* result);
 }
+
+/*!
+    @category WebUIDelegate2
+    @discussion A class that supplements the IWebUIDelegate interface
+*/
+[
+    object,
+    oleautomation,
+    uuid(C6FF73E1-304D-4129-A60C-66326C2578DB),
+    pointer_default(unique)
+]
+interface IWebUIDelegate2 : IWebUIDelegate
+{
+    /*!
+        @method print:
+        @abstract Informs that a WebView needs to be printed
+        @param webView The WebView sending the delegate method and whose mainFrame needs to be printed
+    */
+    HRESULT print([in] IWebView* webView);
+
+}
diff --git a/WebKit/win/WebChromeClient.cpp b/WebKit/win/WebChromeClient.cpp
index 67fb67b..71eb9a0 100644
--- a/WebKit/win/WebChromeClient.cpp
+++ b/WebKit/win/WebChromeClient.cpp
@@ -442,3 +442,13 @@
 {
     m_webView->setToolTip(toolTip);
 }
+
+void WebChromeClient::print()
+{
+    COMPtr<IWebUIDelegate> uiDelegate;
+    COMPtr<IWebUIDelegate2> uiDelegate2;
+    if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+        if (SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegate2, (void**) &uiDelegate2)) && uiDelegate2)
+            uiDelegate2->print(m_webView);
+    }
+}
diff --git a/WebKit/win/WebChromeClient.h b/WebKit/win/WebChromeClient.h
index e190239..d014c40 100644
--- a/WebKit/win/WebChromeClient.h
+++ b/WebKit/win/WebChromeClient.h
@@ -92,6 +92,8 @@
 
     virtual void setToolTip(const WebCore::String&);
 
+    virtual void print();
+
 private:
     WebView* m_webView;
 };