⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 194076 in webkit


Ignore:
Timestamp:
Dec 14, 2015, 4:35:22 PM (11 years ago)
Author:
matthew_hanson@apple.com
Message:

Merge r188553. rdar://problem/23816165

Location:
branches/safari-601-branch/Source/WebKit2
Files:
11 edited
4 copied

Legend:

Unmodified
Added
Removed
  • branches/safari-601-branch/Source/WebKit2/ChangeLog

    r194075 r194076  
     12015-12-08  Harris Papadopoulos  <cpapadopoulos@apple.com>
     2
     3        Merge r188553. rdar://problem/23816165
     4
     5    2015-08-13  Anders Carlsson  <andersca@apple.com>
     6
     7            Add WKWindowFeaturesRef and a new modern createNewPage UI client callback
     8            https://bugs.webkit.org/show_bug.cgi?id=147989
     9
     10            Reviewed by Tim Horton.
     11
     12            Re-land this and make sure we actually allocate a WKWindowFeatures object.
     13
     14            * Platform/IPC/mac/ConnectionMac.mm:
     15            * Shared/API/APIObject.h:
     16            * Shared/API/c/WKBase.h:
     17            * UIProcess/API/APIWindowFeatures.cpp: Added.
     18            * UIProcess/API/APIWindowFeatures.h: Added.
     19            * UIProcess/API/C/WKAPICast.h:
     20            * UIProcess/API/C/WKPage.cpp:
     21            (WKPageSetPageUIClient):
     22            * UIProcess/API/C/WKPageUIClient.h:
     23            * UIProcess/API/C/WKWindowFeaturesRef.cpp: Added.
     24            (WKWindowFeaturesGetTypeID):
     25            * UIProcess/API/C/WKWindowFeaturesRef.h: Added.
     26            * UIProcess/API/Cocoa/WKWindowFeatures.mm:
     27            (-[WKWindowFeatures dealloc]):
     28            (-[WKWindowFeatures menuBarVisibility]):
     29            (-[WKWindowFeatures statusBarVisibility]):
     30            (-[WKWindowFeatures toolbarsVisibility]):
     31            (-[WKWindowFeatures allowsResizing]):
     32            (-[WKWindowFeatures x]):
     33            (-[WKWindowFeatures y]):
     34            (-[WKWindowFeatures width]):
     35            (-[WKWindowFeatures height]):
     36            (-[WKWindowFeatures _apiObject]):
     37            (-[WKWindowFeatures _initWithWindowFeatures:]): Deleted.
     38            * UIProcess/API/Cocoa/WKWindowFeaturesInternal.h:
     39            (WebKit::wrapper):
     40            * UIProcess/Cocoa/UIDelegate.mm:
     41            (WebKit::UIDelegate::UIClient::createNewPage):
     42            * WebKit2.xcodeproj/project.pbxproj:
     43
    1442015-12-08  Harris Papadopoulos  <cpapadopoulos@apple.com>
    245
  • branches/safari-601-branch/Source/WebKit2/Shared/API/APIObject.h

    r186484 r194076  
    149149        WebsiteDataRecord,
    150150        WebsiteDataStore,
     151        WindowFeatures,
    151152
    152153#if ENABLE(MEDIA_SESSION)
  • branches/safari-601-branch/Source/WebKit2/Shared/API/c/WKBase.h

    r186484 r194076  
    142142typedef const struct OpaqueWKViewportAttributes* WKViewportAttributesRef;
    143143typedef const struct OpaqueWKWebsiteDataStore* WKWebsiteDataStoreRef;
     144typedef const struct OpaqueWKWindowFeatures* WKWindowFeaturesRef;
    144145
    145146/* WebKit2 Bundle types */
  • branches/safari-601-branch/Source/WebKit2/Shared/Cocoa/APIObject.mm

    r185877 r194076  
    6161#import "WKWebsiteDataRecordInternal.h"
    6262#import "WKWebsiteDataStoreInternal.h"
     63#import "WKWindowFeaturesInternal.h"
    6364#import "_WKDownloadInternal.h"
    6465#import "_WKFrameHandleInternal.h"
     
    218219        break;
    219220
     221    case Type::WindowFeatures:
     222        wrapper = [WKWindowFeatures alloc];
     223        break;
     224
    220225    case Type::BundleFrame:
    221226        wrapper = [WKWebProcessPlugInFrame alloc];
  • branches/safari-601-branch/Source/WebKit2/UIProcess/API/APIWindowFeatures.cpp

    r194075 r194076  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #import "WKWindowFeatures.h"
     26#include "config.h"
     27#include "APIWindowFeatures.h"
    2728
    28 #if WK_API_ENABLED
     29namespace API {
    2930
    30 namespace WebCore {
    31 struct WindowFeatures;
     31Ref<WindowFeatures> WindowFeatures::create(const WebCore::WindowFeatures& windowFeatures)
     32{
     33    return adoptRef(*new WindowFeatures(windowFeatures));
    3234}
    3335
    34 @interface WKWindowFeatures ()
     36WindowFeatures::WindowFeatures(const WebCore::WindowFeatures& windowFeatures)
     37    : m_windowFeatures(windowFeatures)
     38{
     39}
    3540
    36 - (instancetype)_initWithWindowFeatures:(const WebCore::WindowFeatures&)windowFeatures;
     41WindowFeatures::~WindowFeatures()
     42{
     43}
    3744
    38 @end
    39 
    40 #endif
     45}
  • branches/safari-601-branch/Source/WebKit2/UIProcess/API/APIWindowFeatures.h

    r194075 r194076  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #import "WKWindowFeatures.h"
     26#ifndef APIWindowFeatures_h
     27#define APIWindowFeatures_h
    2728
    28 #if WK_API_ENABLED
     29#include "APIObject.h"
     30#include <WebCore/WindowFeatures.h>
    2931
    30 namespace WebCore {
    31 struct WindowFeatures;
     32namespace API {
     33
     34class WindowFeatures final : public ObjectImpl<Object::Type::WindowFeatures> {
     35public:
     36    static Ref<WindowFeatures> create(const WebCore::WindowFeatures&);
     37    virtual ~WindowFeatures();
     38
     39    const WebCore::WindowFeatures& windowFeatures() const { return m_windowFeatures; }
     40
     41private:
     42    explicit WindowFeatures(const WebCore::WindowFeatures&);
     43
     44    const WebCore::WindowFeatures m_windowFeatures;
     45};
     46
    3247}
    3348
    34 @interface WKWindowFeatures ()
    35 
    36 - (instancetype)_initWithWindowFeatures:(const WebCore::WindowFeatures&)windowFeatures;
    37 
    38 @end
    39 
    40 #endif
     49#endif // APIWindowFeatures_h
  • branches/safari-601-branch/Source/WebKit2/UIProcess/API/C/WKAPICast.h

    r187084 r194076  
    6565class UserScript;
    6666class WebsiteDataStore;
     67class WindowFeatures;
    6768}
    6869
     
    165166WK_ADD_API_MAPPING(WKViewportAttributesRef, WebViewportAttributes)
    166167WK_ADD_API_MAPPING(WKWebsiteDataStoreRef, API::WebsiteDataStore)
     168WK_ADD_API_MAPPING(WKWindowFeaturesRef, API::WindowFeatures)
    167169
    168170/* Enum conversions */
  • branches/safari-601-branch/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r194075 r194076  
    4242#include "APISessionState.h"
    4343#include "APIUIClient.h"
     44#include "APIWindowFeatures.h"
    4445#include "AuthenticationChallengeProxy.h"
    4546#include "LegacySessionStateCoding.h"
     
    103104
    104105template<> struct ClientTraits<WKPageUIClientBase> {
    105     typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5> Versions;
     106    typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6> Versions;
    106107};
    107108
     
    13421343
    13431344    private:
    1344         virtual PassRefPtr<WebPageProxy> createNewPage(WebPageProxy* page, WebFrameProxy*, const SecurityOriginData&, const ResourceRequest& resourceRequest, const WindowFeatures& windowFeatures, const NavigationActionData& navigationActionData) override
    1345         {
    1346             if (!m_client.base.version && !m_client.createNewPage_deprecatedForUseWithV0)
    1347                 return 0;
    1348 
    1349             if (m_client.base.version > 0 && !m_client.createNewPage)
    1350                 return 0;
    1351 
    1352             API::Dictionary::MapType map;
    1353             if (windowFeatures.x)
    1354                 map.set("x", API::Double::create(*windowFeatures.x));
    1355             if (windowFeatures.y)
    1356                 map.set("y", API::Double::create(*windowFeatures.y));
    1357             if (windowFeatures.width)
    1358                 map.set("width", API::Double::create(*windowFeatures.width));
    1359             if (windowFeatures.height)
    1360                 map.set("height", API::Double::create(*windowFeatures.height));
    1361             map.set("menuBarVisible", API::Boolean::create(windowFeatures.menuBarVisible));
    1362             map.set("statusBarVisible", API::Boolean::create(windowFeatures.statusBarVisible));
    1363             map.set("toolBarVisible", API::Boolean::create(windowFeatures.toolBarVisible));
    1364             map.set("locationBarVisible", API::Boolean::create(windowFeatures.locationBarVisible));
    1365             map.set("scrollbarsVisible", API::Boolean::create(windowFeatures.scrollbarsVisible));
    1366             map.set("resizable", API::Boolean::create(windowFeatures.resizable));
    1367             map.set("fullscreen", API::Boolean::create(windowFeatures.fullscreen));
    1368             map.set("dialog", API::Boolean::create(windowFeatures.dialog));
    1369             Ref<API::Dictionary> featuresMap = API::Dictionary::create(WTF::move(map));
    1370 
    1371             if (!m_client.base.version)
    1372                 return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV0(toAPI(page), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
    1373 
    1374             Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
    1375             return adoptRef(toImpl(m_client.createNewPage(toAPI(page), toAPI(request.ptr()), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
     1345        virtual PassRefPtr<WebPageProxy> createNewPage(WebPageProxy* page, WebFrameProxy* initiatingFrame, const SecurityOriginData& securityOriginData, const ResourceRequest& resourceRequest, const WindowFeatures& windowFeatures, const NavigationActionData& navigationActionData) override
     1346        {
     1347            if (m_client.base.version < 6) {
     1348                if (!m_client.base.version && !m_client.createNewPage_deprecatedForUseWithV0)
     1349                    return nullptr;
     1350
     1351                if (!m_client.createNewPage_deprecatedForUseWithV1)
     1352                    return nullptr;
     1353
     1354                API::Dictionary::MapType map;
     1355                if (windowFeatures.x)
     1356                    map.set("x", API::Double::create(*windowFeatures.x));
     1357                if (windowFeatures.y)
     1358                    map.set("y", API::Double::create(*windowFeatures.y));
     1359                if (windowFeatures.width)
     1360                    map.set("width", API::Double::create(*windowFeatures.width));
     1361                if (windowFeatures.height)
     1362                    map.set("height", API::Double::create(*windowFeatures.height));
     1363                map.set("menuBarVisible", API::Boolean::create(windowFeatures.menuBarVisible));
     1364                map.set("statusBarVisible", API::Boolean::create(windowFeatures.statusBarVisible));
     1365                map.set("toolBarVisible", API::Boolean::create(windowFeatures.toolBarVisible));
     1366                map.set("locationBarVisible", API::Boolean::create(windowFeatures.locationBarVisible));
     1367                map.set("scrollbarsVisible", API::Boolean::create(windowFeatures.scrollbarsVisible));
     1368                map.set("resizable", API::Boolean::create(windowFeatures.resizable));
     1369                map.set("fullscreen", API::Boolean::create(windowFeatures.fullscreen));
     1370                map.set("dialog", API::Boolean::create(windowFeatures.dialog));
     1371                Ref<API::Dictionary> featuresMap = API::Dictionary::create(WTF::move(map));
     1372
     1373                if (!m_client.base.version)
     1374                    return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV0(toAPI(page), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
     1375
     1376                Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
     1377                return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV1(toAPI(page), toAPI(request.ptr()), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
     1378            }
     1379
     1380            if (!m_client.createNewPage)
     1381                return nullptr;
     1382
     1383            auto configuration = page->configuration().copy();
     1384            configuration->setRelatedPage(page);
     1385
     1386            auto sourceFrameInfo = API::FrameInfo::create(*initiatingFrame, securityOriginData.securityOrigin());
     1387
     1388            bool shouldOpenAppLinks = !protocolHostAndPortAreEqual(WebCore::URL(WebCore::ParsedURLString, initiatingFrame->url()), resourceRequest.url());
     1389            auto apiNavigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, resourceRequest, WebCore::URL(), shouldOpenAppLinks);
     1390
     1391            auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures);
     1392
     1393            return adoptRef(toImpl(m_client.createNewPage(toAPI(page), toAPI(configuration.ptr()), toAPI(apiNavigationAction.ptr()), toAPI(apiWindowFeatures.ptr()), m_client.base.clientInfo)));
    13761394        }
    13771395
  • branches/safari-601-branch/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h

    r186484 r194076  
    5050
    5151typedef void (*WKPageUIClientCallback)(WKPageRef page, const void* clientInfo);
    52 typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
     52typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo);
    5353typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo);
    5454typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo);
     
    102102typedef bool (*WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
    103103typedef WKStringRef (*WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo);
     104typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV1)(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
    104105
    105106typedef struct WKPageUIClientBase {
     
    198199
    199200    // Version 1.
    200     WKPageCreateNewPageCallback                                         createNewPage;
     201    WKPageCreateNewPageCallback_deprecatedForUseWithV1                  createNewPage;
    201202    WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
    202203    WKPageDecidePolicyForNotificationPermissionRequestCallback          decidePolicyForNotificationPermissionRequest;
     
    249250
    250251    // Version 1.
    251     WKPageCreateNewPageCallback                                         createNewPage;
     252    WKPageCreateNewPageCallback_deprecatedForUseWithV1                  createNewPage;
    252253    WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
    253254    WKPageDecidePolicyForNotificationPermissionRequestCallback          decidePolicyForNotificationPermissionRequest;
     
    305306
    306307    // Version 1.
    307     WKPageCreateNewPageCallback                                         createNewPage;
     308    WKPageCreateNewPageCallback_deprecatedForUseWithV1                  createNewPage;
    308309    WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
    309310    WKPageDecidePolicyForNotificationPermissionRequestCallback          decidePolicyForNotificationPermissionRequest;
     
    364365
    365366    // Version 1.
    366     WKPageCreateNewPageCallback                                         createNewPage;
     367    WKPageCreateNewPageCallback_deprecatedForUseWithV1                  createNewPage;
    367368    WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
    368369    WKPageDecidePolicyForNotificationPermissionRequestCallback          decidePolicyForNotificationPermissionRequest;
     
    429430
    430431    // Version 1.
    431     WKPageCreateNewPageCallback                                         createNewPage;
     432    WKPageCreateNewPageCallback_deprecatedForUseWithV1                  createNewPage;
    432433    WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
    433434    WKPageDecidePolicyForNotificationPermissionRequestCallback          decidePolicyForNotificationPermissionRequest;
     
    457458} WKPageUIClientV5;
    458459
    459 enum { kWKPageUIClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 2 };
    460 typedef struct WKPageUIClient {
    461     int                                                                 version;
    462     const void *                                                        clientInfo;
    463 
    464     // Version 0.
    465     WKPageCreateNewPageCallback_deprecatedForUseWithV0                  createNewPage_deprecatedForUseWithV0;
    466     WKPageUIClientCallback                                              showPage;
    467     WKPageUIClientCallback                                              close;
    468     WKPageTakeFocusCallback                                             takeFocus;
    469     WKPageFocusCallback                                                 focus;
    470     WKPageUnfocusCallback                                               unfocus;
    471     WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0             runJavaScriptAlert;
    472     WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0           runJavaScriptConfirm;
    473     WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0            runJavaScriptPrompt;
     460typedef struct WKPageUIClientV6 {
     461    WKPageUIClientBase                                                  base;
     462
     463    // Version 0.
     464    WKPageCreateNewPageCallback_deprecatedForUseWithV0                  createNewPage_deprecatedForUseWithV0;
     465    WKPageUIClientCallback                                              showPage;
     466    WKPageUIClientCallback                                              close;
     467    WKPageTakeFocusCallback                                             takeFocus;
     468    WKPageFocusCallback                                                 focus;
     469    WKPageUnfocusCallback                                               unfocus;
     470    WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0             runJavaScriptAlert_deprecatedForUseWithV0;
     471    WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0           runJavaScriptConfirm_deprecatedForUseWithV0;
     472    WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0            runJavaScriptPrompt_deprecatedForUseWithV0;
    474473    WKPageSetStatusTextCallback                                         setStatusText;
    475474    WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0        mouseDidMoveOverElement_deprecatedForUseWithV0;
     
    504503
    505504    // Version 1.
    506     WKPageCreateNewPageCallback                                         createNewPage;
     505    WKPageCreateNewPageCallback_deprecatedForUseWithV1                  createNewPage_deprecatedForUseWithV1;
    507506    WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
    508507    WKPageDecidePolicyForNotificationPermissionRequestCallback          decidePolicyForNotificationPermissionRequest;
     
    513512    WKPageHideColorPickerCallback                                       hideColorPicker;
    514513    WKPageUnavailablePluginButtonClickedCallback                        unavailablePluginButtonClicked;
    515 } WKPageUIClient WK_C_DEPRECATED("Use an explicit versioned struct instead");
     514
     515    // Version 3.
     516    WKPagePinnedStateDidChangeCallback                                  pinnedStateDidChange;
     517
     518    // Version 4.
     519    WKPageDidBeginTrackingPotentialLongMousePressCallback               didBeginTrackingPotentialLongMousePress;
     520    WKPageDidRecognizeLongMousePressCallback                            didRecognizeLongMousePress;
     521    WKPageDidCancelTrackingPotentialLongMousePressCallback              didCancelTrackingPotentialLongMousePress;
     522    WKPageIsPlayingAudioDidChangeCallback                               isPlayingAudioDidChange;
     523
     524    // Version 5.
     525    WKPageDecidePolicyForUserMediaPermissionRequestCallback             decidePolicyForUserMediaPermissionRequest;
     526    WKPageDidClickAutoFillButtonCallback                                didClickAutoFillButton;
     527    WKPageRunJavaScriptAlertCallback                                    runJavaScriptAlert;
     528    WKPageRunJavaScriptConfirmCallback                                  runJavaScriptConfirm;
     529    WKPageRunJavaScriptPromptCallback                                   runJavaScriptPrompt;
     530    WKPageMediaSessionMetadataDidChangeCallback                         mediaSessionMetadataDidChange;
     531
     532    // Version 6.
     533    WKPageCreateNewPageCallback                                         createNewPage;
     534
     535} WKPageUIClientV6;
    516536
    517537#ifdef __cplusplus
  • branches/safari-601-branch/Source/WebKit2/UIProcess/API/C/WKWindowFeaturesRef.cpp

    r194075 r194076  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #import "WKWindowFeatures.h"
     26#include "config.h"
     27#include "WKWindowFeaturesRef.h"
    2728
    28 #if WK_API_ENABLED
     29#include "APIWindowFeatures.h"
     30#include "WKAPICast.h"
    2931
    30 namespace WebCore {
    31 struct WindowFeatures;
     32WKTypeID WKWindowFeaturesGetTypeID()
     33{
     34    return WebKit::toAPI(API::WindowFeatures::APIType);
    3235}
    33 
    34 @interface WKWindowFeatures ()
    35 
    36 - (instancetype)_initWithWindowFeatures:(const WebCore::WindowFeatures&)windowFeatures;
    37 
    38 @end
    39 
    40 #endif
  • branches/safari-601-branch/Source/WebKit2/UIProcess/API/C/WKWindowFeaturesRef.h

    r194075 r194076  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #import "WKWindowFeatures.h"
     26#ifndef WKWindowFeaturesRef_h
     27#define WKWindowFeaturesRef_h
    2728
    28 #if WK_API_ENABLED
     29#include <WebKit/WKBase.h>
    2930
    30 namespace WebCore {
    31 struct WindowFeatures;
     31#ifdef __cplusplus
     32extern "C" {
     33#endif
     34
     35WK_EXPORT WKTypeID WKWindowFeaturesGetTypeID();
     36
     37#ifdef __cplusplus
    3238}
     39#endif
    3340
    34 @interface WKWindowFeatures ()
    35 
    36 - (instancetype)_initWithWindowFeatures:(const WebCore::WindowFeatures&)windowFeatures;
    37 
    38 @end
    39 
    40 #endif
     41#endif // WKWindowFeaturesRef_h
  • branches/safari-601-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeatures.mm

    r194075 r194076  
    3232#import <wtf/RetainPtr.h>
    3333
    34 @implementation WKWindowFeatures {
    35     RetainPtr<NSNumber> _menuBarVisibility;
    36     RetainPtr<NSNumber> _statusBarVisibility;
    37     RetainPtr<NSNumber> _toolbarsVisibility;
     34@implementation WKWindowFeatures
    3835
    39     RetainPtr<NSNumber> _allowsResizing;
     36- (void)dealloc
     37{
     38    _windowFeatures->API::WindowFeatures::~WindowFeatures();
    4039
    41     RetainPtr<NSNumber> _x;
    42     RetainPtr<NSNumber> _y;
    43     RetainPtr<NSNumber> _width;
    44     RetainPtr<NSNumber> _height;
    45 }
    46 
    47 - (instancetype)_initWithWindowFeatures:(const WebCore::WindowFeatures&)windowFeatures
    48 {
    49     if (!(self = [super init]))
    50         return nil;
    51 
    52     // FIXME: These should be set to nil if the features didn't exist in the string.
    53     _menuBarVisibility = @(windowFeatures.menuBarVisible);
    54     _statusBarVisibility = @(windowFeatures.statusBarVisible);
    55     _toolbarsVisibility = @(windowFeatures.toolBarVisible || windowFeatures.locationBarVisible);
    56     _allowsResizing = @(windowFeatures.resizable);
    57 
    58     if (windowFeatures.x)
    59         _x = @(*windowFeatures.x);
    60     if (windowFeatures.y)
    61         _y = @(*windowFeatures.y);
    62     if (windowFeatures.width)
    63         _width = @(*windowFeatures.width);
    64     if (windowFeatures.height)
    65         _height = @(*windowFeatures.height);
    66 
    67     return self;
     40    [super dealloc];
    6841}
    6942
    7043- (NSNumber *)menuBarVisibility
    7144{
    72     return _menuBarVisibility.get();
     45    return @(_windowFeatures->windowFeatures().menuBarVisible);
    7346}
    7447
    7548- (NSNumber *)statusBarVisibility
    7649{
    77     return _statusBarVisibility.get();
     50    return @(_windowFeatures->windowFeatures().statusBarVisible);
    7851}
    7952
    8053- (NSNumber *)toolbarsVisibility
    8154{
    82     return _toolbarsVisibility.get();
     55    return @(_windowFeatures->windowFeatures().toolBarVisible);
    8356}
    8457
    8558- (NSNumber *)allowsResizing
    8659{
    87     return _allowsResizing.get();
     60    return @(_windowFeatures->windowFeatures().resizable);
    8861}
    8962
    9063- (NSNumber *)x
    9164{
    92     return _x.get();
     65    if (auto x = _windowFeatures->windowFeatures().x)
     66        return @(*x);
     67
     68    return nil;
    9369}
    9470
    9571- (NSNumber *)y
    9672{
    97     return _y.get();
     73    if (auto y = _windowFeatures->windowFeatures().y)
     74        return @(*y);
     75
     76    return nil;
    9877}
    9978
    10079- (NSNumber *)width
    10180{
    102     return _width.get();
     81    if (auto width = _windowFeatures->windowFeatures().width)
     82        return @(*width);
     83
     84    return nil;
    10385}
    10486
    10587- (NSNumber *)height
    10688{
    107     return _height.get();
     89    if (auto height = _windowFeatures->windowFeatures().height)
     90        return @(*height);
     91
     92    return nil;
     93}
     94
     95#pragma mark WKObject protocol implementation
     96
     97- (API::Object&)_apiObject
     98{
     99    return *_windowFeatures;
    108100}
    109101
  • branches/safari-601-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeaturesInternal.h

    r166244 r194076  
    2828#if WK_API_ENABLED
    2929
    30 namespace WebCore {
    31 struct WindowFeatures;
     30#import "APIWindowFeatures.h"
     31#import "WKObject.h"
     32
     33namespace WebKit {
     34
     35inline WKWindowFeatures *wrapper(API::WindowFeatures& windowFeatures)
     36{
     37    ASSERT([windowFeatures.wrapper() isKindOfClass:[WKWindowFeatures class]]);
     38
     39    return (WKWindowFeatures *)windowFeatures.wrapper();
    3240}
    3341
    34 @interface WKWindowFeatures ()
    35 
    36 - (instancetype)_initWithWindowFeatures:(const WebCore::WindowFeatures&)windowFeatures;
    37 
     42}
     43@interface WKWindowFeatures () <WKObject> {
     44@package
     45    API::ObjectStorage<API::WindowFeatures> _windowFeatures;
     46}
    3847@end
    3948
  • branches/safari-601-branch/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm

    r187390 r194076  
    115115
    116116    bool shouldOpenAppLinks = !protocolHostAndPortAreEqual(WebCore::URL(WebCore::ParsedURLString, initiatingFrame->url()), request.url());
    117     auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, request, WebCore::URL(), shouldOpenAppLinks);
    118 
    119     RetainPtr<WKWebView> webView = [delegate.get() webView:m_uiDelegate.m_webView createWebViewWithConfiguration:configuration.get() forNavigationAction:wrapper(navigationAction) windowFeatures:adoptNS([[WKWindowFeatures alloc] _initWithWindowFeatures:windowFeatures]).get()];
     117    auto apiNavigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, request, WebCore::URL(), shouldOpenAppLinks);
     118
     119    auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures);
     120
     121    RetainPtr<WKWebView> webView = [delegate.get() webView:m_uiDelegate.m_webView createWebViewWithConfiguration:configuration.get() forNavigationAction:wrapper(apiNavigationAction) windowFeatures:wrapper(apiWindowFeatures)];
    120122
    121123    if (!webView)
  • branches/safari-601-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r186788 r194076  
    286286                1A64245F12DE29A100CAAE2C /* UpdateInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */; };
    287287                1A6509CE18B4146200614332 /* WKProcessPoolPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6509CD18B4146200614332 /* WKProcessPoolPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
     288                1A6563E41B7A8C50009CF787 /* APIWindowFeatures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6563E21B7A8C50009CF787 /* APIWindowFeatures.cpp */; };
     289                1A6563E51B7A8C50009CF787 /* APIWindowFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6563E31B7A8C50009CF787 /* APIWindowFeatures.h */; };
    288290                1A66BF8F18A052ED002071B4 /* WKWebViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A66BF8E18A052ED002071B4 /* WKWebViewInternal.h */; };
    289291                1A6F9F9011E13EFC00DB1371 /* CommandLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */; };
     
    301303                1A7865B916CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7865B716CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp */; };
    302304                1A7865BA16CAC71500ACE83A /* PluginProcessConnectionManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7865B816CAC71500ACE83A /* PluginProcessConnectionManagerMessages.h */; };
     305                1A7C0DF61B7D1F1000A9B848 /* WKWindowFeaturesRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7C0DF41B7D1F1000A9B848 /* WKWindowFeaturesRef.cpp */; };
     306                1A7C0DF71B7D1F1000A9B848 /* WKWindowFeaturesRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7C0DF51B7D1F1000A9B848 /* WKWindowFeaturesRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
    303307                1A7C6CDA1378950800B9C04D /* EnvironmentVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7C6CD81378950800B9C04D /* EnvironmentVariables.cpp */; };
    304308                1A7C6CDB1378950800B9C04D /* EnvironmentVariables.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7C6CD91378950800B9C04D /* EnvironmentVariables.h */; };
     
    23822386                1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UpdateInfo.cpp; sourceTree = "<group>"; };
    23832387                1A6509CD18B4146200614332 /* WKProcessPoolPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProcessPoolPrivate.h; sourceTree = "<group>"; };
     2388                1A6563E21B7A8C50009CF787 /* APIWindowFeatures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIWindowFeatures.cpp; sourceTree = "<group>"; };
     2389                1A6563E31B7A8C50009CF787 /* APIWindowFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIWindowFeatures.h; sourceTree = "<group>"; };
    23842390                1A66BF8E18A052ED002071B4 /* WKWebViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewInternal.h; sourceTree = "<group>"; };
    23852391                1A6D141F1B0167D500785FF0 /* Info-OSX-10.9-10.10.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-OSX-10.9-10.10.plist"; sourceTree = "<group>"; };
     
    24002406                1A7865B716CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessConnectionManagerMessageReceiver.cpp; sourceTree = "<group>"; };
    24012407                1A7865B816CAC71500ACE83A /* PluginProcessConnectionManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessConnectionManagerMessages.h; sourceTree = "<group>"; };
     2408                1A7C0DF41B7D1F1000A9B848 /* WKWindowFeaturesRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKWindowFeaturesRef.cpp; sourceTree = "<group>"; };
     2409                1A7C0DF51B7D1F1000A9B848 /* WKWindowFeaturesRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWindowFeaturesRef.h; sourceTree = "<group>"; };
    24022410                1A7C6CD81378950800B9C04D /* EnvironmentVariables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EnvironmentVariables.cpp; sourceTree = "<group>"; };
    24032411                1A7C6CD91378950800B9C04D /* EnvironmentVariables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EnvironmentVariables.h; sourceTree = "<group>"; };
     
    62496257                                1A3635A71A3144A300ED6197 /* APIWebsiteDataStore.cpp */,
    62506258                                1A3635A81A3144A300ED6197 /* APIWebsiteDataStore.h */,
     6259                                1A6563E21B7A8C50009CF787 /* APIWindowFeatures.cpp */,
     6260                                1A6563E31B7A8C50009CF787 /* APIWindowFeatures.h */,
    62516261                        );
    62526262                        path = API;
     
    63826392                                1A57109C1ABA0027002FABBE /* WKWebsiteDataStoreRef.cpp */,
    63836393                                1A57109D1ABA0027002FABBE /* WKWebsiteDataStoreRef.h */,
     6394                                1A7C0DF41B7D1F1000A9B848 /* WKWindowFeaturesRef.cpp */,
     6395                                1A7C0DF51B7D1F1000A9B848 /* WKWindowFeaturesRef.h */,
    63846396                        );
    63856397                        path = C;
     
    80458057                                1A4832D11A9BDC2F008B4DFE /* WebsiteDataRecord.h in Headers */,
    80468058                                1A53C2AA1A325730004E8C70 /* WebsiteDataStore.h in Headers */,
     8059                                1A6563E51B7A8C50009CF787 /* APIWindowFeatures.h in Headers */,
    80478060                                836034A01ACB34D600626549 /* WebSQLiteDatabaseTracker.h in Headers */,
    80488061                                1A52C0F81A38CDC70016160A /* WebStorageNamespaceProvider.h in Headers */,
     
    81708183                                C54256BA18BEC18C00DE4179 /* WKFormSelectControl.h in Headers */,
    81718184                                BCE4695A1214EDF4000B98EB /* WKFormSubmissionListener.h in Headers */,
     8185                                1A7C0DF71B7D1F1000A9B848 /* WKWindowFeaturesRef.h in Headers */,
    81728186                                37DFA7001810BB92001F4A9F /* WKFoundation.h in Headers */,
    81738187                                BCD0139B110FA420003B8A67 /* WKFrame.h in Headers */,
     
    93629376                                7C89D2A61A6789EA003A5FDE /* APIUserScript.cpp in Sources */,
    93639377                                C5E1AFEC16B21012006CC1F2 /* APIWebArchive.mm in Sources */,
     9378                                1A7C0DF61B7D1F1000A9B848 /* WKWindowFeaturesRef.cpp in Sources */,
    93649379                                C5E1AFEE16B21025006CC1F2 /* APIWebArchiveResource.mm in Sources */,
    93659380                                1A4832C71A9BC13C008B4DFE /* APIWebsiteDataRecord.cpp in Sources */,
     
    1002610041                                BC407601124FF0270068F20A /* WKNumber.cpp in Sources */,
    1002710042                                7CD5EBB81746A15B000C1C45 /* WKObjCTypeWrapperRef.mm in Sources */,
     10043                                1A6563E41B7A8C50009CF787 /* APIWindowFeatures.cpp in Sources */,
    1002810044                                374436881820E7240049579F /* WKObject.mm in Sources */,
    1002910045                                BC85806312B8505700EDEB2E /* WKOpenPanelParameters.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.