-
Notifications
You must be signed in to change notification settings - Fork 859
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
Content picker native inject #25411
Content picker native inject #25411
Conversation
A Storybook has been deployed to preview UI for the latest push |
A Storybook has been deployed to preview UI for the latest push |
A Storybook has been deployed to preview UI for the latest push |
app/brave_generated_resources.grd
Outdated
<message name="IDS_ADBLOCK_CONTEXT_BLOCK_ELEMENT" desc="Message for context menu that enables the element picker UI to apply cosmetic filter rules to the page (was 'elementPickerMode' from Brave Extension)"> | ||
Block element | ||
</message> | ||
<message name="IDS_ADBLOCK_CONTEXT_MANAGE_CUSTOM_FILTERS" desc="Message for context menu that opens a page for adding, editing, and removing custom cosmetic filters (was 'manageCustomFilters' from Brave Extension)"> | ||
Manage custom filters |
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.
The parenthesized parts probably aren't relevant to translators
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.
Ok, I will remove it.
My intention was to reuse the current locale keys in the brave extension.
I suppose we can do it another way by tagging a right person.
menu_model_.InsertSubMenuWithStringIdAt( | ||
*print_index + 1, IDC_ADBLOCK_CONTEXT_TOOLS, IDS_ADBLOCK_CONTEXT_TOOLS, | ||
&adblock_submenu_model_); |
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.
Have you tried SetIcon
and/or SetMinorIcon
here? I assume one of those should work if we want to restore the Brave logo
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.
I haven't tried because normally the menu has icons only in the extension block.
No problem to restore it if we really need.
124a67f
to
78de4da
Compare
78de4da
to
a719d4b
Compare
8ed38da
to
00663c9
Compare
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.
strings
++
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.
Asked in DM about the benefits of RenderFrameHostReceiverSet
over AssociatedReceiverSet
but assume it's ok. JS / HTML changes look good.
@@ -1,12 +1,23 @@ | |||
# Copyright (c) 2020 The Brave Authors. All rights reserved. |
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.
It's a bit strange that these files are in resources/data
since it's not data but is executed scripts / UI. How about resources/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.
Your point makes sense.
But that dir also has content_cosmetic.ts
that don't have UI and also injected by cosmetic_filters_js_handler.
So making a separate dir and BUILD.gn
make the code more sophisticated without extra benefits.
About P.S. A single |
Verification PASSED on
Using the STR/Cases outlined via brave/brave-browser#40821 (comment), went through the following:
|
Example |
Example |
Example |
Example |
---|---|---|---|
Test Case #1
- Menu Positions/Block Trackers disabled
- ensured that
Block element
is always aboveInspect
via the context menu - ensured that
Block element
is not being displayed when viewing the context menu when selecting text - ensured that
Block element
is being displayed via the context menu for links - ensured that
Block element
is not being displayed forNTP
&brave://
pages - ensured that
Block element
is not being displayed whenAllow all trackers & ads
- ensured that
Block element
is being displayed whenBlock trackers & ads
&Aggressive
is selected
- ensured that
Example |
Example |
Example |
Example |
---|---|---|---|
Example |
Example |
Example |
---|---|---|
Uplift of #25411 (squashed) to beta
Resolves brave/brave-browser#40821
For brave/brave-browser#40994
UPD: the PR is updated to match the new product requirements. The brave/browser code to communicated with frames moved to a dedicated tab helper created on demand.
The PR:
context menu => tab_helper =(mojo)=> a frame agent(CosmeticFiltersJSHandler) => execute JS in a isolated world
. The same world as for cosmetic filters is used.JS => the frame agent =(mojo)=> CosmeticFiltersResources(task_runner) => AdblockService(task_runner) => AdblockService(UI)
brave://settings/shields/filters
.ads&trackers
is on. Otherwise it can't efficiently hide elements.chrome.braveShields
impl are removed.A product-related questions:
brave/brave-browser#40821 (comment)
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:
brave/brave-browser#40821 (comment)