Skip to content

helium/ui: add "Copy link" action to downloads context menu#1511

Open
saberoueslati wants to merge 8 commits into
imputnet:mainfrom
saberoueslati:feat/copy-download-link
Open

helium/ui: add "Copy link" action to downloads context menu#1511
saberoueslati wants to merge 8 commits into
imputnet:mainfrom
saberoueslati:feat/copy-download-link

Conversation

@saberoueslati

@saberoueslati saberoueslati commented Apr 28, 2026

Copy link
Copy Markdown

For your pull request to not get closed without review, please confirm that:

  • An issue exists where the maintainers agreed that this should be implemented
    (an approved feature request, or confirmed bug).
  • I tested that my contribution works locally, and does not break anything,
    otherwise I have marked my PR as draft.
  • If my contribution is non-trivial, I did not use AI to write most of it.
  • I understand that I will be permanently banned from interacting with this
    organization if I lied by checking any of these checkboxes.

Tested on (check one or more):

  • Windows
  • macOS
  • Linux

I tested my PR only on Linux at the moment, leaving this as a draft until I test on Windows, I'm building helium there at this moment

Edit : Tested also on Windows
Video of manual test below :

Screencast.from.2026-04-29.00-09-03.webm

Closes #897

Adds a "Copy link" option to the download context menu that copies the original download source URL to the clipboard. Available on in-progress, paused, finished, and interrupted downloads.

Changes

  • New COPY_DOWNLOAD_LINK command wired through all model/controller layers
  • Clipboard write implemented via ScopedClipboardWriter in DownloadUIModel::ExecuteCommand
  • Menu item added to all four context menu states in download_ui_context_menu.cc
  • Stats tracking added (kCopyDownloadLinkEnabled, kCopyDownloadLinkClicked)
  • New IDS_DOWNLOAD_MENU_COPY_LINK string ("Copy link") in generated_resources.grd

@saberoueslati

Copy link
Copy Markdown
Author

I had also errors in the CI/CD piepline, I'll fix them then make it ready for review

@nsk-47

nsk-47 commented Apr 29, 2026

Copy link
Copy Markdown

I had also errors in the CI/CD piepline, I'll fix them then make it ready for review

It is possible to have clear/clear from list option similar to firefox?

dumbmoron
dumbmoron previously approved these changes May 2, 2026

@dumbmoron dumbmoron left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment on lines +163 to +166
+ <message name="IDS_DOWNLOAD_MENU_COPY_LINK"
+ desc="Download context menu: Copy the download source URL to the clipboard">
+ Copy link
+ </message>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check it when I'm home later this evening

@saberoueslati saberoueslati May 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dumbmoron I replaced IDS_DOWNLOAD_MENU_COPY_LINK with preexisting IDS_DOWNLOAD_COPY_DOWNLOAD_LINK

@saberoueslati saberoueslati May 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dumbmoron Video of the manual test after the change

Screencast.from.2026-05-05.02-09-21.webm

I'm struggling to test on Windows, build is very slow there, test done on Ubuntu works perfectly. If testing on Windows is necessary, I'll keep working on it there; otherwise the PR is ready to be merged

@saberoueslati saberoueslati marked this pull request as ready for review May 5, 2026 00:43
@greptile-apps

greptile-apps Bot commented May 5, 2026

Copy link
Copy Markdown

Reviews (1): Last reviewed commit: "updated source.gen.json" | Re-trigger Greptile

Comment on lines +122 to +124
+ case DownloadCommands::COPY_DOWNLOAD_LINK:
+ id = IDS_DOWNLOAD_COPY_DOWNLOAD_LINK;
+ break;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Missing GRD string resource causes build failure

The patch references IDS_DOWNLOAD_COPY_DOWNLOAD_LINK in download_ui_context_menu.cc, but no change to generated_resources.grd defining this string ID is included anywhere in the patch. The PR description mentions adding IDS_DOWNLOAD_MENU_COPY_LINK (a different name) to the GRD file, but that entry is also absent from the patch. Without the corresponding GRD entry, the build will fail with an undefined symbol error. The patch needs a hunk that adds the new string to generated_resources.grd, and the ID used there must exactly match IDS_DOWNLOAD_COPY_DOWNLOAD_LINK.

Comment on lines +88 to +95
// kReviewEnabled = 34,
// kReviewClicked = 35,
kNotReached = 36, // Should not be possible to hit
- kMaxValue = kNotReached
+ kCopyDownloadLinkEnabled = 37,
+ kCopyDownloadLinkClicked = 38,
+ kMaxValue = kCopyDownloadLinkClicked
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 kNotReached no longer semantically last in the stats enum

kCopyDownloadLinkEnabled = 37 and kCopyDownloadLinkClicked = 38 are appended after kNotReached = 36, which carries the comment "Should not be possible to hit". The intent of kNotReached is to act as a sentinel for an unreachable default branch; placing new valid values after it leaves it stranded in the middle of the enum, which is confusing and may cause future values to be mispositioned as well. The two new values should be inserted before kNotReached, keeping it last (or rename/remove it as the sentinel).

@saberoueslati saberoueslati marked this pull request as draft May 5, 2026 01:02
@saberoueslati saberoueslati marked this pull request as ready for review May 5, 2026 01:09
@greptile-apps

greptile-apps Bot commented May 5, 2026

Copy link
Copy Markdown

Reviews (2): Last reviewed commit: "updated source.gen.json" | Re-trigger Greptile

Comment on lines +25 to +26
+ case DownloadCommands::COPY_DOWNLOAD_LINK:
return true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 IsCommandEnabled returns true unconditionally for invalid/empty URLs

COPY_DOWNLOAD_LINK is always enabled regardless of whether GetURL() returns a valid URL. If the URL is empty (e.g. some offline items or edge-case downloads), GetURL().spec() returns an empty string, which silently overwrites the user's clipboard with nothing. The base IsCommandEnabled case should return GetURL().is_valid() instead of falling through to return true.

@saberoueslati saberoueslati requested a review from dumbmoron May 5, 2026 01:37
@saberoueslati

Copy link
Copy Markdown
Author

@dumbmoron Finally also tested on Windows, works as intended there too

Enregistrement.2026-05-05.174531.mp4

dumbmoron
dumbmoron previously approved these changes May 10, 2026
Comment thread patches/series
Co-authored-by: jj <log@riseup.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR]: "Copy Download Link" context menu action in downloads bubble

3 participants