Title: [159991] trunk/Source/WebKit2
Revision
159991
Author
[email protected]
Date
2013-12-02 20:25:07 -0800 (Mon, 02 Dec 2013)

Log Message

[Cocoa] WebProtectionSpace has a generic wrapper
https://bugs.webkit.org/show_bug.cgi?id=125125

Reviewed by Anders Carlsson.

Added WKNSURLProtectionSpace.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject): Allocate a WKNSURLProtectionSpace if the object is a
WebProtectionSpace.
* Shared/Cocoa/WKNSURLProtectionSpace.h: Added.
(WebKit::wrapper): Added. Returns a WebProtecitonSpace’s wrapper as an NSURLProtectionSpace.
* Shared/Cocoa/WKNSURLProtectionSpace.mm: Added.
(-[WKNSURLProtectionSpace copyWithZone:]): Retains self.
* UIProcess/Authentication/WebProtectionSpace.h:
(WebKit::WebProtectionSpace::protectionSpace): Added an accessor for the
WebCore::ProtectionSpace.
* WebKit2.xcodeproj/project.pbxproj: Added references to new files.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (159990 => 159991)


--- trunk/Source/WebKit2/ChangeLog	2013-12-03 04:19:07 UTC (rev 159990)
+++ trunk/Source/WebKit2/ChangeLog	2013-12-03 04:25:07 UTC (rev 159991)
@@ -1,3 +1,24 @@
+2013-12-02  Dan Bernstein  <[email protected]>
+
+        [Cocoa] WebProtectionSpace has a generic wrapper
+        https://bugs.webkit.org/show_bug.cgi?id=125125
+
+        Reviewed by Anders Carlsson.
+
+        Added WKNSURLProtectionSpace.
+
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::newObject): Allocate a WKNSURLProtectionSpace if the object is a
+        WebProtectionSpace.
+        * Shared/Cocoa/WKNSURLProtectionSpace.h: Added.
+        (WebKit::wrapper): Added. Returns a WebProtecitonSpace’s wrapper as an NSURLProtectionSpace.
+        * Shared/Cocoa/WKNSURLProtectionSpace.mm: Added.
+        (-[WKNSURLProtectionSpace copyWithZone:]): Retains self.
+        * UIProcess/Authentication/WebProtectionSpace.h:
+        (WebKit::WebProtectionSpace::protectionSpace): Added an accessor for the
+        WebCore::ProtectionSpace.
+        * WebKit2.xcodeproj/project.pbxproj: Added references to new files.
+
 2013-12-02  Anders Carlsson  <[email protected]>
 
         Replace uses of WebKit::APIClient with API::Client

Modified: trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm (159990 => 159991)


--- trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm	2013-12-03 04:19:07 UTC (rev 159990)
+++ trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm	2013-12-03 04:25:07 UTC (rev 159991)
@@ -37,6 +37,7 @@
 #import "WKNSError.h"
 #import "WKNSString.h"
 #import "WKNSURL.h"
+#import "WKNSURLProtectionSpace.h"
 #import "WKNavigationDataInternal.h"
 #import "WKProcessGroupInternal.h"
 
@@ -97,6 +98,10 @@
         wrapper = [WKBrowsingContextGroup alloc];
         break;
 
+    case Type::ProtectionSpace:
+        wrapper = NSAllocateObject([WKNSURLProtectionSpace class], size, nullptr);
+        break;
+
     case Type::String:
         wrapper = NSAllocateObject([WKNSString class], size, nullptr);
         break;

Added: trunk/Source/WebKit2/Shared/Cocoa/WKNSURLProtectionSpace.h (0 => 159991)


--- trunk/Source/WebKit2/Shared/Cocoa/WKNSURLProtectionSpace.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/Cocoa/WKNSURLProtectionSpace.h	2013-12-03 04:25:07 UTC (rev 159991)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2013 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. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+#import "WKFoundation.h"
+
+#if WK_API_ENABLED
+
+#import "WKObject.h"
+#import "WebProtectionSpace.h"
+
+namespace WebKit {
+
+inline NSURLProtectionSpace *wrapper(WebProtectionSpace& protectionSpace)
+{
+    ASSERT([protectionSpace.wrapper() isKindOfClass:[NSURLProtectionSpace self]]);
+    return (NSURLProtectionSpace *)protectionSpace.wrapper();
+}
+
+}
+
+@interface WKNSURLProtectionSpace : WKObject <NSCopying>
+@end
+
+#endif // WK_API_ENABLED

Added: trunk/Source/WebKit2/Shared/Cocoa/WKNSURLProtectionSpace.mm (0 => 159991)


--- trunk/Source/WebKit2/Shared/Cocoa/WKNSURLProtectionSpace.mm	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/Cocoa/WKNSURLProtectionSpace.mm	2013-12-03 04:25:07 UTC (rev 159991)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2013 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. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+#import "config.h"
+#import "WKNSURLProtectionSpace.h"
+
+#if WK_API_ENABLED
+
+#import <WebCore/AuthenticationMac.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+@implementation WKNSURLProtectionSpace
+
+- (NSObject *)_web_createTarget
+{
+    return [mac(reinterpret_cast<WebProtectionSpace*>(&self._apiObject)->protectionSpace()) copy];
+}
+
+#pragma mark NSCopying protocol implementation
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
+
+@end
+
+#endif // WK_API_ENABLED

Modified: trunk/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h (159990 => 159991)


--- trunk/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h	2013-12-03 04:19:07 UTC (rev 159990)
+++ trunk/Source/WebKit2/UIProcess/Authentication/WebProtectionSpace.h	2013-12-03 04:25:07 UTC (rev 159991)
@@ -48,6 +48,8 @@
     bool receivesCredentialSecurely() const;
     WebCore::ProtectionSpaceAuthenticationScheme authenticationScheme() const;
 
+    const WebCore::ProtectionSpace& protectionSpace() const { return m_coreProtectionSpace; }
+
 private:
     explicit WebProtectionSpace(const WebCore::ProtectionSpace&);
 

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (159990 => 159991)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2013-12-03 04:19:07 UTC (rev 159990)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2013-12-03 04:25:07 UTC (rev 159991)
@@ -436,6 +436,8 @@
 		37183D57182F4E700080C811 /* WKNSURLExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 37183D55182F4E700080C811 /* WKNSURLExtras.h */; };
 		371A19411824D29300F32A5E /* WKNSDictionary.mm in Sources */ = {isa = PBXBuildFile; fileRef = 371A193F1824D29300F32A5E /* WKNSDictionary.mm */; };
 		371A19421824D29300F32A5E /* WKNSDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 371A19401824D29300F32A5E /* WKNSDictionary.h */; };
+		371B32DD184D67490013E2B2 /* WKNSURLProtectionSpace.mm in Sources */ = {isa = PBXBuildFile; fileRef = 371B32DB184D67480013E2B2 /* WKNSURLProtectionSpace.mm */; };
+		371B32DE184D67490013E2B2 /* WKNSURLProtectionSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 371B32DC184D67490013E2B2 /* WKNSURLProtectionSpace.h */; };
 		372CAF0B1833FD910040AC27 /* WKNSError.h in Headers */ = {isa = PBXBuildFile; fileRef = 372CAF091833FD910040AC27 /* WKNSError.h */; };
 		372CAF0C1833FD910040AC27 /* WKNSError.mm in Sources */ = {isa = PBXBuildFile; fileRef = 372CAF0A1833FD910040AC27 /* WKNSError.mm */; };
 		374436881820E7240049579F /* WKObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374436871820E7240049579F /* WKObject.mm */; };
@@ -1976,6 +1978,8 @@
 		37183D55182F4E700080C811 /* WKNSURLExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSURLExtras.h; sourceTree = "<group>"; };
 		371A193F1824D29300F32A5E /* WKNSDictionary.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSDictionary.mm; sourceTree = "<group>"; };
 		371A19401824D29300F32A5E /* WKNSDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSDictionary.h; sourceTree = "<group>"; };
+		371B32DB184D67480013E2B2 /* WKNSURLProtectionSpace.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSURLProtectionSpace.mm; sourceTree = "<group>"; };
+		371B32DC184D67490013E2B2 /* WKNSURLProtectionSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSURLProtectionSpace.h; sourceTree = "<group>"; };
 		372CAF091833FD910040AC27 /* WKNSError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSError.h; sourceTree = "<group>"; };
 		372CAF0A1833FD910040AC27 /* WKNSError.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSError.mm; sourceTree = "<group>"; };
 		374436871820E7240049579F /* WKObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObject.mm; sourceTree = "<group>"; };
@@ -3821,6 +3825,8 @@
 				378E1A4B18208D700031007A /* WKNSURL.mm */,
 				37183D55182F4E700080C811 /* WKNSURLExtras.h */,
 				37183D54182F4E700080C811 /* WKNSURLExtras.mm */,
+				371B32DC184D67490013E2B2 /* WKNSURLProtectionSpace.h */,
+				371B32DB184D67480013E2B2 /* WKNSURLProtectionSpace.mm */,
 				378E1A3F181EDA010031007A /* WKObject.h */,
 				374436871820E7240049579F /* WKObject.mm */,
 			);
@@ -5605,6 +5611,7 @@
 				B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */,
 				2989A414167D184B004F96D2 /* CustomProtocolManager.h in Headers */,
 				865E0485181A094A001F72F2 /* ViewState.h in Headers */,
+				371B32DE184D67490013E2B2 /* WKNSURLProtectionSpace.h in Headers */,
 				2984F589164BA095004BC0C6 /* CustomProtocolManagerMessages.h in Headers */,
 				29AD3093164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h in Headers */,
 				2984F57D164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h in Headers */,
@@ -7071,6 +7078,7 @@
 				2D2ADF1016364D8200197E47 /* PDFPluginChoiceAnnotation.mm in Sources */,
 				2D429BFD1721E2C700EC681F /* PDFPluginPasswordField.mm in Sources */,
 				2D2ADF0916362DD500197E47 /* PDFPluginTextAnnotation.mm in Sources */,
+				371B32DD184D67490013E2B2 /* WKNSURLProtectionSpace.mm in Sources */,
 				BCF505E81243047B005955AE /* CertificateInfo.mm in Sources */,
 				BCC43ABA127B95DC00317F16 /* PlatformPopupMenuData.cpp in Sources */,
 				1A6FB7D211E651E200DB1371 /* Plugin.cpp in Sources */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to