-
Notifications
You must be signed in to change notification settings - Fork 985
Add Containers Settings section. #29230
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
base: master
Are you sure you want to change the base?
Conversation
de3c3c1
to
b1ef987
Compare
A Storybook has been deployed to preview UI for the latest push |
86ee3a4
to
417acdd
Compare
b1ef987
to
365f646
Compare
fc9db4f
to
80cdee9
Compare
PR is ready for review. PTAL. |
5d51f4d
to
44c127a
Compare
// Update an existing container. | ||
for (auto& c : containers) { | ||
if (c->id == container->id) { | ||
c = std::move(container); |
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.
nothing happens here? Should this be NOTREACHED
or something for now with a TODO issue link?
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.
maybe these should all be left as empty for now and split this into two PRs where this one just has a stub implementation on the cpp side? This feels like it's getting kind of big and while the PR does say it handles add and remove only, it's a bit confusing that modify is left partially implemented. I think it would be better to just move all of the implementations to a separate PR(s)?
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.
maybe these should all be left as empty for now and split this into two PRs where this one just has a stub implementation on the cpp side? This feels like it's getting kind of big and while the PR does say it handles add and remove only, it's a bit confusing that modify is left partially implemented. I think it would be better to just move all of the implementations to a separate PR(s)?
Update is implemented correctly. If a container is not found then it should not be updated/added, nor an error should be displayed. This is an edge case that should just not crash and not modify anything in case a container is removed at the same time via sync.
We can't allow Update
call to add a new container, because id
should always be generated on the C++ side.
|
||
// Interface for browser -> renderer communication. This interface allows the | ||
// browser process to notify the renderer about changes to the containers list. | ||
interface SettingsPage { |
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.
Shouldn't this be something like ContainersObserver
?
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.
If it's behaving purely like an observer then perhaps and sure, why not. We usually call it SettingsUI
because it's not necessarily or always a one-to-many blind observer pattern, sometimes the browser wants to do an explicit action on a single UI client, but it's rare.
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.
Team, I just followed an existing approach in all Chromium WebUIs. They usually use Page/PageHandler
.
upd: renamed to ContainersSettingsHandler
, ContainersSettingsObserver
.
interface SettingsPageHandlerFactory { | ||
// Creates a new settings page handler and establishes bidirectional | ||
// communication between the browser and renderer processes. | ||
CreateSettingsPageHandler( | ||
pending_remote<SettingsPage> page, | ||
pending_receiver<SettingsPageHandler> page_handler); | ||
}; |
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.
We probably don't need this since the main interface doesn't need any parameters relevant to the page to be created
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 did this exactly how webui_explainer.md
recommends to wire both ends in a single mojo call. Should I go against the recommended approach?
I agree a BraveSettingsUI
class pollution is a bit of a downside here, but this is how Chromium currently prefers this webui/c++/mojo integration to work.
[puLL-Merge] - brave/brave-core@29230 DescriptionThis PR adds a new "Containers" feature to Brave browser that allows users to organize their browsing with separate containers. Each container maintains isolated cookies, storage, and site data while sharing the same browser profile. The implementation includes:
Possible Issues
Security Hotspots
Privacy Hotspots
ChangesChangesapp/BUILD.gn & app/brave_settings_strings.grdp
browser/DEPS & browser/brave_content_browser_client.cc
browser/brave_profile_prefs.cc
browser/resources/settings/
browser/ui/webui/brave_settings_ui.cc & .h
components/containers/core/
chromium_src/components/sync_preferences/
sequenceDiagram
participant UI as Settings UI
participant Proxy as Browser Proxy
participant Handler as Settings Handler
participant Prefs as Preferences
participant Delegate as Container Delegate
UI->>Proxy: User adds container
Proxy->>Handler: AddOrUpdateContainer(container)
Handler->>Handler: Generate UUID for new container
Handler->>Prefs: SetContainersToPrefs(containers)
Prefs->>Handler: OnContainersChanged()
Handler->>UI: OnContainersChanged(containers)
UI->>Proxy: User deletes container
Proxy->>Handler: RemoveContainer(id)
Handler->>Delegate: RemoveContainerData(id, callback)
Delegate->>Handler: OnContainerDataRemoved(id, callback)
Handler->>Prefs: SetContainersToPrefs(filtered containers)
Prefs->>Handler: OnContainersChanged()
Handler->>UI: OnContainersChanged(containers)
Handler->>UI: callback() [after 5s delay]
|
Warning You have got a presubmit warning. Please address it if possible.
Items:
|
This PR adds basic Containers settings UI to be able to add and remove containers into prefs. The PR intentionally does not add color and icon UI for containers to keep things simple and land more features iteratively.
Resolves brave/brave-browser#46351
r3IyNIIKt2.mp4