Title: [175190] trunk/Source/WebKit2
Revision
175190
Author
[email protected]
Date
2014-10-24 16:10:30 -0700 (Fri, 24 Oct 2014)

Log Message

Share sheet doesn't attach to the window
https://bugs.webkit.org/show_bug.cgi?id=138062
<rdar://problem/18767397>

Reviewed by Beth Dakin.

* UIProcess/mac/WKActionMenuController.h:
WKActionMenuController is now a NSSharingService{Picker}Delegate.

* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController _defaultMenuItemsForImage]):
Set us up as the NSSharingServicePicker delegate.

(-[WKActionMenuController sharingServicePicker:delegateForSharingService:]):
Set us up as the NSSharingService delegate.

(-[WKActionMenuController sharingService:sourceWindowForShareItems:sharingContentScope:]):
Return the appropriate window to attach to.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (175189 => 175190)


--- trunk/Source/WebKit2/ChangeLog	2014-10-24 23:03:34 UTC (rev 175189)
+++ trunk/Source/WebKit2/ChangeLog	2014-10-24 23:10:30 UTC (rev 175190)
@@ -1,3 +1,24 @@
+2014-10-24  Tim Horton  <[email protected]>
+
+        Share sheet doesn't attach to the window
+        https://bugs.webkit.org/show_bug.cgi?id=138062
+        <rdar://problem/18767397>
+
+        Reviewed by Beth Dakin.
+
+        * UIProcess/mac/WKActionMenuController.h:
+        WKActionMenuController is now a NSSharingService{Picker}Delegate.
+
+        * UIProcess/mac/WKActionMenuController.mm:
+        (-[WKActionMenuController _defaultMenuItemsForImage]):
+        Set us up as the NSSharingServicePicker delegate.
+
+        (-[WKActionMenuController sharingServicePicker:delegateForSharingService:]):
+        Set us up as the NSSharingService delegate.
+
+        (-[WKActionMenuController sharingService:sourceWindowForShareItems:sharingContentScope:]):
+        Return the appropriate window to attach to.
+
 2014-10-24  Jer Noble  <[email protected]>
 
         Abstractify WebOriginDataManager to support arbitrary ChildProcess supplements.

Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.h (175189 => 175190)


--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.h	2014-10-24 23:03:34 UTC (rev 175189)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.h	2014-10-24 23:10:30 UTC (rev 175190)
@@ -28,6 +28,7 @@
 
 #import "ActionMenuHitTestResult.h"
 #import "WKActionMenuItemTypes.h"
+#import <AppKit/NSSharingService.h>
 #import <wtf/RetainPtr.h>
 
 namespace WebKit {
@@ -40,10 +41,9 @@
 };
 }
 
-@class NSSharingServicePicker;
 @class WKView;
 
-@interface WKActionMenuController : NSObject {
+@interface WKActionMenuController : NSObject <NSSharingServiceDelegate, NSSharingServicePickerDelegate> {
 @private
     WebKit::WebPageProxy *_page;
     WKView *_wkView;

Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (175189 => 175190)


--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-10-24 23:03:34 UTC (rev 175189)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-10-24 23:10:30 UTC (rev 175190)
@@ -192,6 +192,7 @@
         RetainPtr<CGImageRef> image = bitmap->makeCGImage();
         RetainPtr<NSImage> nsImage = adoptNS([[NSImage alloc] initWithCGImage:image.get() size:NSZeroSize]);
         _sharingServicePicker = adoptNS([[NSSharingServicePicker alloc] initWithItems:@[ nsImage.get() ]]);
+        [_sharingServicePicker setDelegate:self];
         [shareItem setSubmenu:[_sharingServicePicker menu]];
     }
 
@@ -291,6 +292,20 @@
     });
 }
 
+#pragma mark NSSharingServicePickerDelegate implementation
+
+- (id <NSSharingServiceDelegate>)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker delegateForSharingService:(NSSharingService *)sharingService
+{
+    return self;
+}
+
+#pragma mark NSSharingServiceDelegate implementation
+
+- (NSWindow *)sharingService:(NSSharingService *)sharingService sourceWindowForShareItems:(NSArray *)items sharingContentScope:(NSSharingContentScope *)sharingContentScope
+{
+    return _wkView.window;
+}
+
 #pragma mark Menu Items
 
 - (RetainPtr<NSMenuItem>)_createActionMenuItemForTag:(uint32_t)tag
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to