| Code-Review | +1 |
Tom LukaszewiczAlso did a few renames:
- looks like we're agreed on the new class names (ProfileBrowserCollection, GlobalBrowserCollection, BrowserCollectionObserver) so I moved ProfileBrowsers -> ProfileBrowserCollection
- also renamed some methods as Dana suggested: OnBrowserWasCreated -> OnBrowserCreated, OnBrowserWasClosed -> OnBrowserClosed, OnBrowserDidBecomeActive -> OnBrowserActivated, and OnBrowserDidBecomeInactive -> OnBrowserDeactivated
Good stuff - new names sgtm!
std::vector<std::unique_ptr<BrowserAndSubscriptions>>
browsers_and_subscriptions_;nit: We should be able to make this
```
std::vector<BrowserAndSubscriptions> browsers_and_subscriptions_;
```
std::pair<base::CallbackListSubscription,
base::CallbackListSubscription>>;optional: We could make this a vector (since we don't care about the specific subscriptions and it simplifies the typedef slightly) - though playing around with construction it didn't seem easy with a `std::vector`, the simplest I could make `AddBrowser()` was
```
std::vector<base::CallbackListSubscription> subscriptions;
subscriptions.push_back(browser->RegisterDidBecomeActive(base::BindRepeating(
&BrowserManagerService::OnBrowserActivated, base::Unretained(this))));
subscriptions.push_back(browser->RegisterDidBecomeActive(base::BindRepeating(
&BrowserManagerService::OnBrowserDeactivated, base::Unretained(this))));
browsers_and_subscriptions_.push_back(
BrowserAndSubscriptions(std::move(browser), std::move(subscriptions)));
```
so not sure if worth it (up to your judgement)
std::make_unique<BrowserAndSubscriptions>(nit: If we eliminate the `unique_ptr` from the vector above this becomes `std::pair` I believe
std::unique_ptr<BrowserAndSubscriptions> target_browser_and_subscriptions;nit: This can become a `std::optional` (assuming change to `browsers_and_subscriptions_` above)
public:nit: We should add a defaulted overridden destructor here also
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
std::vector<std::unique_ptr<BrowserAndSubscriptions>>
browsers_and_subscriptions_;nit: We should be able to make this
```
std::vector<BrowserAndSubscriptions> browsers_and_subscriptions_;
```
Done
std::pair<base::CallbackListSubscription,
base::CallbackListSubscription>>;optional: We could make this a vector (since we don't care about the specific subscriptions and it simplifies the typedef slightly) - though playing around with construction it didn't seem easy with a `std::vector`, the simplest I could make `AddBrowser()` was
```
std::vector<base::CallbackListSubscription> subscriptions;
subscriptions.push_back(browser->RegisterDidBecomeActive(base::BindRepeating(
&BrowserManagerService::OnBrowserActivated, base::Unretained(this))));
subscriptions.push_back(browser->RegisterDidBecomeActive(base::BindRepeating(
&BrowserManagerService::OnBrowserDeactivated, base::Unretained(this))));
browsers_and_subscriptions_.push_back(
BrowserAndSubscriptions(std::move(browser), std::move(subscriptions)));
```
so not sure if worth it (up to your judgement)
I prefer it this way, personally (using pair over vector). The typedef is a bit more complex, yes, but it feels weird to me to use a dynamically-sized type when we know there will always be exactly 2 items. I think it would be (slightly) misleading for a reader to see a vector - they could assume there could be any number of subscriptions.
nit: If we eliminate the `unique_ptr` from the vector above this becomes `std::pair` I believe
Done
std::unique_ptr<BrowserAndSubscriptions> target_browser_and_subscriptions;nit: This can become a `std::optional` (assuming change to `browsers_and_subscriptions_` above)
Done
nit: We should add a defaulted overridden destructor here also
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
18 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: chrome/browser/ui/browser_manager_service.cc
Insertions: 12, Deletions: 14.
The diff is too large to show. Please review the diff.
```
```
The name of the file: chrome/browser/ui/browser_manager_service.h
Insertions: 1, Deletions: 2.
The diff is too large to show. Please review the diff.
```
```
The name of the file: chrome/browser/ui/browser_window/public/browser_collection_observer.h
Insertions: 2, Deletions: 0.
The diff is too large to show. Please review the diff.
```
Implement BrowserCollectionObserver and ProfileBrowserCollection.
`BrowserCollectionObserver` is intended to be a direct replacement for
`BrowserListObserver` (but for `BrowserWindowInterface` instead of
`Browser`).
`ProfileBrowserCollection` represents an observable collection of all
BrowserWindowInterface objects **in a given profile**. In a future CL,
we'll add a `GlobalBrowserCollection` class as well, which will be a more direct
equivalent of the current BrowserList but for BrowserWindowInterfaces.
See
https://docs.google.com/document/d/1aQRPDX9RjWHE48rAHntsV64VU1-4uZO_nkL6A7ohr2k/edit?tab=t.5u9lkywxkk2n
for design details.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |