Title: [175339] trunk/Source/WebKit2
- Revision
- 175339
- Author
- [email protected]
- Date
- 2014-10-29 13:24:13 -0700 (Wed, 29 Oct 2014)
Log Message
Hide the 'Add to Photos' item if it isn't available
https://bugs.webkit.org/show_bug.cgi?id=138182
<rdar://problem/18814999>
Reviewed by Beth Dakin.
* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController _defaultMenuItemsForImage]):
(-[WKActionMenuController _canAddImageToPhotos]):
(-[WKActionMenuController _addImageToPhotos:]):
Factor _canAddImageToPhotos out of _addImageToPhotos:, and use it in
_defaultMenuItemsForImage to avoid including the menu item in the first place.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (175338 => 175339)
--- trunk/Source/WebKit2/ChangeLog 2014-10-29 19:08:14 UTC (rev 175338)
+++ trunk/Source/WebKit2/ChangeLog 2014-10-29 20:24:13 UTC (rev 175339)
@@ -1,5 +1,20 @@
2014-10-29 Tim Horton <[email protected]>
+ Hide the 'Add to Photos' item if it isn't available
+ https://bugs.webkit.org/show_bug.cgi?id=138182
+ <rdar://problem/18814999>
+
+ Reviewed by Beth Dakin.
+
+ * UIProcess/mac/WKActionMenuController.mm:
+ (-[WKActionMenuController _defaultMenuItemsForImage]):
+ (-[WKActionMenuController _canAddImageToPhotos]):
+ (-[WKActionMenuController _addImageToPhotos:]):
+ Factor _canAddImageToPhotos out of _addImageToPhotos:, and use it in
+ _defaultMenuItemsForImage to avoid including the menu item in the first place.
+
+2014-10-29 Tim Horton <[email protected]>
+
Rename WebPageProxy::activeActionMenuHitTestResult to lastMouseMoveHitTestResult
https://bugs.webkit.org/show_bug.cgi?id=138137
<rdar://problem/18798257>
Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (175338 => 175339)
--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm 2014-10-29 19:08:14 UTC (rev 175338)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm 2014-10-29 20:24:13 UTC (rev 175339)
@@ -64,6 +64,7 @@
@interface WKActionMenuController () <NSSharingServiceDelegate, NSSharingServicePickerDelegate>
- (void)_updateActionMenuItems;
+- (BOOL)_canAddImageToPhotos;
@end
@interface WKView (WKDeprecatedSPI)
@@ -173,7 +174,11 @@
- (NSArray *)_defaultMenuItemsForImage
{
RetainPtr<NSMenuItem> copyImageItem = [self _createActionMenuItemForTag:kWKContextActionItemTagCopyImage];
- RetainPtr<NSMenuItem> addToPhotosItem = [self _createActionMenuItemForTag:kWKContextActionItemTagAddImageToPhotos];
+ RetainPtr<NSMenuItem> addToPhotosItem;
+ if ([self _canAddImageToPhotos])
+ addToPhotosItem = [self _createActionMenuItemForTag:kWKContextActionItemTagAddImageToPhotos];
+ else
+ addToPhotosItem = [NSMenuItem separatorItem];
RetainPtr<NSMenuItem> saveToDownloadsItem = [self _createActionMenuItemForTag:kWKContextActionItemTagSaveImageToDownloads];
RetainPtr<NSMenuItem> shareItem = [self _createActionMenuItemForTag:kWKContextActionItemTagShareImage];
@@ -251,10 +256,14 @@
return path;
}
+- (BOOL)_canAddImageToPhotos
+{
+ return [getIKSlideshowClass() canExportToApplication:@"com.apple.Photos"];
+}
+
- (void)_addImageToPhotos:(id)sender
{
- // FIXME: We shouldn't even add the menu item if this is the case, for now.
- if (![getIKSlideshowClass() canExportToApplication:@"com.apple.Photos"])
+ if (![self _canAddImageToPhotos])
return;
RefPtr<ShareableBitmap> bitmap = _hitTestResult.image;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes