mac:
authortristan <tristan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2007 22:54:56 +0000 (22:54 +0000)
committertristan <tristan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2007 22:54:56 +0000 (22:54 +0000)
        Reviewed by Timothy Hatcher.

        This patch is for the WebKit side of <rdar://problem/5591115>.
        We need a way to tell context menu navigations, such as "Open in New Window"
        to override any sort of browser preference for tab based navigation.

        * WebCoreSupport/WebChromeClient.mm:
        (WebChromeClient::createWindow):
        Pass up the new preferredType parameter as a string.

WebCore:

        Reviewed by Timothy Hatcher.

        This patch is for the WebKit side of <rdar://problem/5591115>.
        We need a way to tell context menu navigations, such as "Open in New Window"
        to override any sort of browser preference for tab based navigation.

        * bridge/WindowFeatures.h:
        (WebCore::WindowFeatures::WindowFeatures):
        Added a new struct member var, preferredType
        and an accompanying enum type PreferredType
        to send a window type recommendation up to the Chrome.

        * page/ContextMenuController.cpp:
        (WebCore::openNewWindow):
        Set the window features to recommend a new Window for
        "Open in New Window" context menu action.

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

WebCore/ChangeLog
WebCore/bridge/WindowFeatures.h
WebCore/page/ContextMenuController.cpp
WebKit/mac/ChangeLog
WebKit/mac/WebCoreSupport/WebChromeClient.mm

index 8742b83a9a1310c915f1ce7b38d84f93993080b1..70bb554547692d344b603a298c3b346e86937def 100644 (file)
@@ -1,3 +1,22 @@
+2007-11-09  Tristan O'Tierney  <tristan@apple.com>
+
+        Reviewed by Timothy Hatcher.
+        
+        This patch is for the WebKit side of <rdar://problem/5591115>.
+        We need a way to tell context menu navigations, such as "Open in New Window"
+        to override any sort of browser preference for tab based navigation.
+
+        * bridge/WindowFeatures.h:
+        (WebCore::WindowFeatures::WindowFeatures):
+        Added a new struct member var, preferredType
+        and an accompanying enum type PreferredType
+        to send a window type recommendation up to the Chrome. 
+        
+        * page/ContextMenuController.cpp:
+        (WebCore::openNewWindow):
+        Set the window features to recommend a new Window for
+        "Open in New Window" context menu action.
+
 2007-11-08  Adam Roben  <aroben@apple.com>
 
         Fix <rdar://5483519> Pressing Enter on selected buttons should fire onclick
index ee4d8ee6d48bbebaf109e15aff8912b1c970b95f..39ab178a3481d8818395933266e65c8510a589f2 100644 (file)
 namespace WebCore {
 
 struct WindowFeatures {
+    typedef enum {
+        PreferUnspecified,
+        PreferNewWindow,
+        PreferNewTab
+    } PreferredType;
+    
     WindowFeatures()
         : xSet(false), ySet(false), widthSet(false), heightSet(false),
           menuBarVisible(true), statusBarVisible(true), toolBarVisible(true),
           locationBarVisible(true), scrollbarsVisible(true), resizable(true),
-          fullscreen(false), dialog(false)
+          fullscreen(false), dialog(false), preferredType(PreferUnspecified)
     {}
 
     float x;
@@ -54,6 +60,7 @@ struct WindowFeatures {
 
     bool fullscreen;
     bool dialog;
+    PreferredType preferredType;
 };
 
 } // namespace WebCore
index 19216ae5cbb00edbb1629f48e2735470998084f8..228c2a3911714a09f8d7843e485868e5f1a66ca9 100644 (file)
@@ -110,6 +110,7 @@ static void openNewWindow(const KURL& urlToLoad, Frame* frame)
 {
     if (Page* oldPage = frame->page()) {
         WindowFeatures features;
+        features.preferredType = WindowFeatures::PreferNewWindow;
         if (Page* newPage = oldPage->chrome()->createWindow(frame,
                 FrameLoadRequest(ResourceRequest(urlToLoad, frame->loader()->outgoingReferrer())), features))
             newPage->chrome()->show();
index f679ed124ab7207dd207e01a8e92d88d7801f939..66757bbd80ed0866e89f4fd7863dc3615118b485 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-09  Tristan O'Tierney  <tristan@apple.com>
+
+        Reviewed by Timothy Hatcher.
+        
+        This patch is for the WebKit side of <rdar://problem/5591115>.
+        We need a way to tell context menu navigations, such as "Open in New Window"
+        to override any sort of browser preference for tab based navigation.
+
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::createWindow):
+        Pass up the new preferredType parameter as a string.
+        
 2007-11-09  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by John.
index cc09eaab382bf5c4ce056655e1198a1134c9d410..983207edf079b1d48cd3790e74cbc5a489ae0704 100644 (file)
@@ -173,6 +173,19 @@ Page* WebChromeClient::createWindow(Frame* frame, const FrameLoadRequest& reques
         if (height)
             [dictFeatures setObject:height forKey:@"height"];
         
+        switch (features.preferredType) {
+            case WindowFeatures::PreferNewWindow:
+                [dictFeatures setObject:@"window" forKey:@"preferredType"];
+                break;
+            case WindowFeatures::PreferNewTab:
+                [dictFeatures setObject:@"tab" forKey:@"preferredType"];
+                break;
+            case WindowFeatures::PreferUnspecified:
+                break;
+            default:
+                ASSERT_NOT_REACHED();
+        }
+                    
         newWebView = CallUIDelegate(m_webView, @selector(webView:createWebViewWithRequest:windowFeatures:), URLRequest, dictFeatures);
         
         [dictFeatures release];