-
Notifications
You must be signed in to change notification settings - Fork 988
[Partitioned Tabs] Add PartitionedTabVisualData #29408
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
77aaea9
to
20f9bdf
Compare
|
||
#include "chrome/browser/ui/tabs/tab_model.h" | ||
|
||
#include "brave/components/containers/core/common/features.h" |
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.
everything related to containers should be under BUILDFLAG(ENABLE_CONTAINERS)
, but I don't think you should mention the containers feature here at all. Just keep partitioned_tab_visual_data_
getters/setter and remove CHECK
calls.
std::optional<PartitionedTabVisualData> | ||
TabInterface::GetPartitionedTabVisualData() const { | ||
return std::nullopt; | ||
} |
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 see what you did here and I think this is interesting, but I'd rather have these default implementations in brave/chromium_src
override for consistency as we have in other places where we add new functions to chromium classes.
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.
Yeah, that's what I'd love to do, but tab_interface.cc
doesn't exist in Chromium, as they conist of pure virtual methods. As you already know, inlining non-emptybody isn't allowed by the chromium-style.
There're several derived classes, I tried to make these new methods have default implementation in this way. Off the top of my head, it might be possible to make "BraveTabInterface" that extends TabInterface
and make others extends BraveTabInterface
instead of TabInterface
, but could be a little bit complex than the current implementation. Do you think it's worth trying to make BraveTabInterface
?
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.
ah, I see now. Thanks for the details!
I'd say having BraveTabInterface
would be a nice touch here, but if it will require a lot of changes in different places, then we might stick with tab_interface.cc
as you currently have it implemented.
Another take here - declare our methods with = 0
and implement them where required in Chromium (tab_model.cc
, tab_android.cc
). Maybe even declare them only on desktop (via buildflag guard) and implement only in tab_model.cc
for now.
} | ||
|
||
void TabModel::SetPartitionedTabVisualData( | ||
const std::optional<PartitionedTabVisualData>& data) { |
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.
std::optional<PartitionedTabVisualData> data
and partitioned_tab_visual_data_ = std::move(data);
#include "components/tabs/public/tab_interface.h" | ||
|
||
// Extends to support getter and setter for partitioned tabs. | ||
#if BUILDFLAG(ENABLE_CONTAINERS) |
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.
pls replace containers reference with #if !BUILDFLAG(IS_ANDROID)
.
this will also be used by Leo, so it should just be bound to "desktop" platform. again, no need to pull "containers" into this tab model extension.
this PR should not add any use of //brave/components/containers
files.
browser/ui/views/tabs/BUILD.gn
Outdated
@@ -54,4 +55,13 @@ source_set("unit_tests") { | |||
"//testing/gmock", | |||
"//testing/gtest", | |||
] | |||
|
|||
if (enable_containers) { |
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.
all mentions of containers should be removed from this PR. please use !is_android
check everywhere.
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 don't think !is_android
is appropriate here as this PR only touches desktop code
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 it's an old habit (not desktop = !android); but yeah, I think you meant:
if (!is_android && !is_ios) {
But I am a bit confused as a guest reading this PR. You're sharing a recommendation to use the OS check
all mentions of containers should be removed from this PR. please use
!is_android
check everywhere.
but then also you shared above:
everything related to containers should be under
BUILDFLAG(ENABLE_CONTAINERS)
I also noticed your containers UI PR here is using #if BUILDFLAG(ENABLE_CONTAINERS)
.
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're in Views so this is already desktop-only. So either we need to gate behind a flag or we leave this API in by default since it isn't being called (and we can gate the calls with a flag, higher up).
// Represents the visual data for a partitioned tab in the tab strip. | ||
// There're two types of partition tabs: | ||
// 1. Container tabs | ||
// 2. Leo tabs |
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 think everything should be using aichat now instead of leo?
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 I think we should call these PartitionedStorageTabs so we're using consistent terminology.
#if !BUILDFLAG(IS_ANDROID) | ||
#define IsActivated \ | ||
IsPartitionedTab() const override; \ | ||
void SetPartitionedTabVisualData( \ |
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 doesn't seem like the right place for this, where would this be called from?
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 think it probably makes sense to have SetPartitionedStorageTab(bool)
, but I'm concerned about how this is going to integrate with saved tab groups and whether we should have our own subclass of TabModel, but it doesn't seem like the TabModel should be where we store PartitionedTabVisualData
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.
actually looking at this again, I'm not sure that it makes sense to have SetPartitionedStorageTab
because that is what creates the need for PartitionedTabVisualData
in the first place and seems to make things overly complicated when we know exactly what types of partitioned storage tabs exist in advance. Maybe SetPartitionedStorageTabType
with an enum for CONTAINER, AICHAT and DISABLED and then based on that the UI code can display the correct icon, etc... without having to tell the tab model about it.
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.
after discussing with @petemill apparently each container tab can have a different icon so an enum doesn't really work, but then I'm also not sure that we should have a generic PartitionedStorageTab
here at all. I think we should just gave SetContainerId
(with kNone
) or something like that and then the UI code can lookup the correct icon based on that. For aichat it would just be SetAIChatTab(bool)
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 think each entry that a person adds can have its own icon (see #29230 for an example where you can add the new containers). Eventually, that listing (add/remove/edit containers) should look like the mock up in brave/brave-browser#46592
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.
etContainerId (with kNone) or something like that and then the UI code can lookup the correct icon based on that. For aichat it would just be SetAIChatTab(bool)
That'd be aligned to other methods like SetSplit() and SetGroup() in the model. Thanks.
Update: We're talking about if it'd be better to keep it as is so that we can work simultaneously.
#include "components/tabs/public/tab_interface.h" | ||
|
||
// Extends to support getter and setter for partitioned tabs. | ||
#if !BUILDFLAG(IS_ANDROID) |
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 is not necessary, this class is already desktop only
The PR description should not be a duplicate of the issue, also this PR does not fully implement the issue, it only provides initial support for the tab model. The issue should be updated to describe only the parts you are implementing here and the PR description should just describe what you're doing, not include all the details from the issue. |
Chromium major version is behind target branch (137.0.7151.68 vs 138.0.7204.25). Please rebase. |
This data will be used to represet partitioned tab-Container tabs and Leo tabs. So it'll be retrieved through TabInterface and set via TabModel.
5486661
to
0f375ba
Compare
PartitionedTabVisualData
will be used to represent PartionedStorage tabs.It'll be retrieved through
TabInterface
and set viaTabModel
,following the upstream's tabs architecture.
Resolves brave/brave-browser#46592