-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds screenshot options to context menu and commands #27083
base: master
Are you sure you want to change the base?
Conversation
0e69a8a
to
4b7451d
Compare
I've refactored this into a TabHelper pattern, with deferred attachment (until user requests a screenshot). Commits landing here in a bit. |
Make sure you follow the latest updates using TabInterface and not WebContentsUserData |
Looking into that now. Thanks! |
22868e1
to
fdd6104
Compare
chromium_src/chrome/browser/renderer_context_menu/render_view_context_menu.cc
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm % nits
If there is nothing selected, we shouldn't attempt to construct an autocomplete match, run the autocomplete classifier, etc. Furthermore, this enables us to simplify tests involving the context menu due to reduced setup.
After rebasing, there is now a failure in this PR unrelated to the contents or changes introduced by the PR itself. A fresh build from scratch will resolve this, but a component build will proceed if any change is made to the policy template file. As such, a typo has been found and fixed so as to 1) Improve the comments, and importantly 2) Fix the build 😀 See https://bravesoftware.slack.com/archives/C7VLGSR55/p1736928018175489?thread_ts=1736911378.517619&cid=C7VLGSR55 for more info.
Removes unused parameters and prefers simpler constructor pattern
4bf06f9
to
1862009
Compare
[puLL-Merge] - brave/brave-core@27083 DescriptionThis PR introduces screenshot functionality to the Brave browser, allowing users to capture full-page screenshots, viewport screenshots, and selected regions. The implementation includes context menu integration and clipboard support. ChangesChanges
sequenceDiagram
participant User
participant ContextMenu
participant BraveScreenshotsTabFeature
participant ScreenshotStrategy
participant Clipboard
User->>ContextMenu: Right-click
ContextMenu->>ContextMenu: MaybeBuildBraveScreenshotsMenu()
User->>ContextMenu: Select Screenshot Option
ContextMenu->>BraveScreenshotsTabFeature: StartScreenshot()
BraveScreenshotsTabFeature->>ScreenshotStrategy: CreateStrategy()
ScreenshotStrategy->>ScreenshotStrategy: Capture()
ScreenshotStrategy-->>BraveScreenshotsTabFeature: OnCaptureComplete()
BraveScreenshotsTabFeature->>Clipboard: CopyImageToClipboard()
BraveScreenshotsTabFeature->>User: DisplayScreenshotBubble()
Possible Issues
Security Hotspots
|
@@ -103,6 +104,18 @@ source_set("ui") { | |||
"webui/skus_internals_ui.h", | |||
] | |||
|
|||
if (enable_brave_screenshots) { | |||
sources += [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should have it's on BUILD.gn and these sources definitely do not belong in browser/ui/BUILD.gn
because they aren't even in browser/ui
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure yet if they should be in browser/ui
instead, but either way there should be a BUILD.gn for the directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also these sources exist in multiple places so something is definitely weird here if you're not getting any errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, there are no errors because they are .h
files, but you should not be adding files like this
Resolves brave/brave-browser#25816
Security/Privacy Review: https://github.com/brave/reviews/issues/1831
screenshot-context-menu.mp4
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Once a screenshot has been taken, you should see a UI element (with a preview of your screenshot) informing you that the screenshot has been copied to your device's clipboard.