Changeset 182879 in webkit


Ignore:
Timestamp:
Apr 15, 2015 8:57:51 PM (9 years ago)
Author:
Brent Fulgham
Message:

[Mac] Disable "Save to Downloads" option for local files
https://bugs.webkit.org/show_bug.cgi?id=143794

Reviewed by Tim Horton.

Disable the Image and Media download options if the download
target is a local file. We can only download web resources;
anything else is actually a no-op.

Source/WebCore:

  • page/ContextMenuController.cpp:

(WebCore::ContextMenuController::checkOrEnableIfNeeded): Disable
menu item if appropriate.

Source/WebKit/mac:

  • WebView/WebActionMenuController.mm:

(-[WebActionMenuController _defaultMenuItemsForImage]):
(-[WebActionMenuController _defaultMenuItemsForVideo]):

Source/WebKit2:

  • UIProcess/mac/WKActionMenuController.mm:

(-[WKActionMenuController _defaultMenuItemsForVideo]):
(-[WKActionMenuController _defaultMenuItemsForImage]):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r182877 r182879  
     12015-04-15  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Mac] Disable "Save to Downloads" option for local files
     4        https://bugs.webkit.org/show_bug.cgi?id=143794
     5
     6        Reviewed by Tim Horton.
     7
     8        Disable the Image and Media download options if the download
     9        target is a local file. We can only download web resources;
     10        anything else is actually a no-op.
     11
     12        * page/ContextMenuController.cpp:
     13        (WebCore::ContextMenuController::checkOrEnableIfNeeded): Disable
     14        menu item if appropriate.
     15
    1162015-04-15  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Source/WebCore/page/ContextMenuController.cpp

    r182748 r182879  
    13351335        case ContextMenuItemTagCopyLinkToClipboard:
    13361336        case ContextMenuItemTagOpenImageInNewWindow:
    1337         case ContextMenuItemTagDownloadImageToDisk:
    13381337        case ContextMenuItemTagCopyImageToClipboard:
    13391338#if PLATFORM(GTK) || PLATFORM(EFL)
    13401339        case ContextMenuItemTagCopyImageUrlToClipboard:
     1340#endif
     1341            break;
     1342        case ContextMenuItemTagDownloadImageToDisk:
     1343#if PLATFORM(MAC)
     1344            if (WebCore::protocolIs(m_context.hitTestResult().absoluteImageURL(), "file"))
     1345                shouldEnable = false;
    13411346#endif
    13421347            break;
     
    13521357            else
    13531358                item.setTitle(contextMenuItemTagDownloadAudioToDisk());
     1359            if (WebCore::protocolIs(m_context.hitTestResult().absoluteImageURL(), "file"))
     1360                shouldEnable = false;
    13541361            break;
    13551362        case ContextMenuItemTagCopyMediaLinkToClipboard:
  • trunk/Source/WebKit/mac/ChangeLog

    r182865 r182879  
     12015-04-15  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Mac] Disable "Save to Downloads" option for local files
     4        https://bugs.webkit.org/show_bug.cgi?id=143794
     5
     6        Reviewed by Tim Horton.
     7
     8        Disable the Image and Media download options if the download
     9        target is a local file. We can only download web resources;
     10        anything else is actually a no-op.
     11
     12        * WebView/WebActionMenuController.mm:
     13        (-[WebActionMenuController _defaultMenuItemsForImage]):
     14        (-[WebActionMenuController _defaultMenuItemsForVideo]):
     15
    1162015-04-15  Alex Christensen  <achristensen@webkit.org>
    217
  • trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm

    r181858 r182879  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    687687        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (image action menu item)", "image action menu item");
    688688        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
     689        enabled = WebCore::protocolIs(_hitTestResult.absoluteImageURL(), "file");
    689690        break;
    690691
     
    699700        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (video action menu item)", "video action menu item");
    700701        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
     702        enabled = WebCore::protocolIs(_hitTestResult.absoluteMediaURL(), "file");
    701703        break;
    702704
  • trunk/Source/WebKit2/ChangeLog

    r182875 r182879  
     12015-04-15  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Mac] Disable "Save to Downloads" option for local files
     4        https://bugs.webkit.org/show_bug.cgi?id=143794
     5
     6        Reviewed by Tim Horton.
     7
     8        Disable the Image and Media download options if the download
     9        target is a local file. We can only download web resources;
     10        anything else is actually a no-op.
     11
     12        * UIProcess/mac/WKActionMenuController.mm:
     13        (-[WKActionMenuController _defaultMenuItemsForVideo]):
     14        (-[WKActionMenuController _defaultMenuItemsForImage]):
     15
    1162015-04-15  Anders Carlsson  <andersca@apple.com>
    217
  • trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm

    r182442 r182879  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    591591        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (image action menu item)", "image action menu item");
    592592        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
     593        enabled = WebCore::protocolIs(hitTestResult->absoluteImageURL(), "file");
    593594        break;
    594595
     
    621622        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (video action menu item)", "video action menu item");
    622623        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
     624        enabled = WebCore::protocolIs(hitTestResult->absoluteMediaURL(), "file");
    623625        break;
    624626
Note: See TracChangeset for help on using the changeset viewer.