Deprecate WKConnection
[WebKit-https.git] / Source / WebKit / UIProcess / API / Cocoa / WKConnection.mm
index ce23d0e..1769a50 100644 (file)
@@ -36,8 +36,6 @@
 #import <wtf/WeakObjCPtr.h>
 #import <wtf/text/WTFString.h>
 
-using namespace WebKit;
-
 @implementation WKConnection {
     WeakObjCPtr<id <WKConnectionDelegate>> _delegate;
 }
@@ -51,26 +49,30 @@ using namespace WebKit;
 
 static void didReceiveMessage(WKConnectionRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
 {
+    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     auto connection = (__bridge WKConnection *)clientInfo;
+    ALLOW_DEPRECATED_DECLARATIONS_END
     auto delegate = connection->_delegate.get();
 
     if ([delegate respondsToSelector:@selector(connection:didReceiveMessageWithName:body:)]) {
         RetainPtr<CFStringRef> nsMessageName = adoptCF(WKStringCopyCFString(kCFAllocatorDefault, messageName));
-        RetainPtr<id> nsMessageBody = static_cast<ObjCObjectGraph*>(toImpl(messageBody))->rootObject();
-        [delegate connection:connection didReceiveMessageWithName:(NSString *)nsMessageName.get() body:nsMessageBody.get()];
+        RetainPtr<id> nsMessageBody = static_cast<WebKit::ObjCObjectGraph*>(WebKit::toImpl(messageBody))->rootObject();
+        [delegate connection:connection didReceiveMessageWithName:(__bridge NSString *)nsMessageName.get() body:nsMessageBody.get()];
     }
 }
 
 static void didClose(WKConnectionRef, const void* clientInfo)
 {
+    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     auto connection = (__bridge WKConnection *)clientInfo;
+    ALLOW_DEPRECATED_DECLARATIONS_END
     auto delegate = connection->_delegate.get();
 
     if ([delegate respondsToSelector:@selector(connectionDidClose:)])
         [delegate connectionDidClose:connection];
 }
 
-static void setUpClient(WKConnection *wrapper, WebConnection& connection)
+static void setUpClient(WKConnection *wrapper, WebKit::WebConnection& connection)
 {
     WKConnectionClientV0 client;
     memset(&client, 0, sizeof(client));
@@ -99,13 +101,13 @@ static void setUpClient(WKConnection *wrapper, WebConnection& connection)
 
 - (void)sendMessageWithName:(NSString *)messageName body:(id)messageBody
 {
-    RefPtr<ObjCObjectGraph> wkMessageBody = ObjCObjectGraph::create(messageBody);
+    RefPtr<WebKit::ObjCObjectGraph> wkMessageBody = WebKit::ObjCObjectGraph::create(messageBody);
     self._connection.postMessage(messageName, wkMessageBody.get());
 }
 
-- (WebConnection&)_connection
+- (WebKit::WebConnection&)_connection
 {
-    return static_cast<WebConnection&>(API::Object::fromWKObjectExtraSpace(self));
+    return static_cast<WebKit::WebConnection&>(API::Object::fromWKObjectExtraSpace(self));
 }
 
 #pragma mark WKObject protocol implementation