#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/ui/startup/focus/focus_handler.h"
#endif
Helmut Januschkastyle: avoid putting conditional includes inside the main blocks. This can be moved to line 150
Done
if (focus_result.status == focus::FocusStatus::kFocused ||
Helmut Januschkacan you please add a comment explaining the intended behavior here? e.g., why do we early-return if there's no match and no command line args?
Done
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
LGTM! I'll comment here once we get launch approval.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
@al...@chromium.org
during review, there where some changes added, so this will require a re-review.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Kaan AlsanThis feature is currently undergoing a formal launch review (http://launch/4425960, for internal folks).
Please hold off on submitting this until the launch is approved (I'll let you know when!)
Kaan AlsanFYI, I'll be OOO from Sep 25th to Oct 5th. I'll try to keep the launch review moving and will provide updates as needed, but won't be active for CL reviews.
We got security and privacy approval. One more approval needed and then I'll +1 this again.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Kaan AlsanThis feature is currently undergoing a formal launch review (http://launch/4425960, for internal folks).
Please hold off on submitting this until the launch is approved (I'll let you know when!)
Kaan AlsanFYI, I'll be OOO from Sep 25th to Oct 5th. I'll try to keep the launch review moving and will provide updates as needed, but won't be active for CL reviews.
We got security and privacy approval. One more approval needed and then I'll +1 this again.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Kaan AlsanThis feature is currently undergoing a formal launch review (http://launch/4425960, for internal folks).
Please hold off on submitting this until the launch is approved (I'll let you know when!)
Kaan AlsanFYI, I'll be OOO from Sep 25th to Oct 5th. I'll try to keep the launch review moving and will provide updates as needed, but won't be active for CL reviews.
Helmut JanuschkaWe got security and privacy approval. One more approval needed and then I'll +1 this again.
anything i can do from my side?
The last approval came in last night, so we are good to launch!
I'll do another pass over this CL and give the +1 shortly
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
// Get the WebAppProvider to access the registrar for app matching
style: comment should end with punctuation
web_app::WebAppProvider* provider =
web_app::WebAppProvider::GetForWebApps(&profile);
web_app::WebAppRegistrar* registrar =
provider ? &provider->registrar_unsafe() : nullptr;
I'm not familiar enough with this code to be sure if this is the correct usage. Adding @dmu...@chromium.org to review this section.
// between apps and regular tabs with similar URLs
style: comments should have a period at the end. Same for other comments below.
web_app::AppBrowserController* app_controller =
browser_window.GetAppBrowserController();
if (app_controller) {
const webapps::AppId& browser_app_id = app_controller->app_id();
const web_app::WebApp* web_app = registrar->GetAppById(browser_app_id);
if (web_app) {
const webapps::ManifestId& manifest_id = web_app->manifest_id();
GURL canonicalized_manifest_id = CanonicalizeUrl(manifest_id);
if (selector.type == SelectorType::kUrlExact) {
is_match = (canonicalized_manifest_id == canonicalized_selector_url);
} else if (selector.type == SelectorType::kUrlPrefix) {
std::string manifest_id_string = canonicalized_manifest_id.spec();
std::string selector_url_string = canonicalized_selector_url.spec();
is_match = base::StartsWith(manifest_id_string, selector_url_string,
base::CompareCase::SENSITIVE);
}
if (is_match) {
matched_app_id = manifest_id.spec();
}
}
}
// For app windows, return early - don't match by tab URL
if (!is_match) {
return std::nullopt;
}
this logic is sufficiently complex that a helper function would be beneficial here.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// Get the WebAppProvider to access the registrar for app matching
style: comment should end with punctuation
Done
style: comments should have a period at the end. Same for other comments below.
Done
web_app::AppBrowserController* app_controller =
browser_window.GetAppBrowserController();
if (app_controller) {
const webapps::AppId& browser_app_id = app_controller->app_id();
const web_app::WebApp* web_app = registrar->GetAppById(browser_app_id);
if (web_app) {
const webapps::ManifestId& manifest_id = web_app->manifest_id();
GURL canonicalized_manifest_id = CanonicalizeUrl(manifest_id);
if (selector.type == SelectorType::kUrlExact) {
is_match = (canonicalized_manifest_id == canonicalized_selector_url);
} else if (selector.type == SelectorType::kUrlPrefix) {
std::string manifest_id_string = canonicalized_manifest_id.spec();
std::string selector_url_string = canonicalized_selector_url.spec();
is_match = base::StartsWith(manifest_id_string, selector_url_string,
base::CompareCase::SENSITIVE);
}
if (is_match) {
matched_app_id = manifest_id.spec();
}
}
}
// For app windows, return early - don't match by tab URL
if (!is_match) {
return std::nullopt;
}
this logic is sufficiently complex that a helper function would be beneficial here.
Done
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
std::optional<std::string> MatchAppByManifestId(
If this is only used within the .cc file, this should be in the anonymous namespace
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
If this is only used within the .cc file, this should be in the anonymous namespace
Done
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
web_app::WebAppProvider* provider =
web_app::WebAppProvider::GetForWebApps(&profile);
web_app::WebAppRegistrar* registrar =
provider ? &provider->registrar_unsafe() : nullptr;
I'm not familiar enough with this code to be sure if this is the correct usage. Adding @dmu...@chromium.org to review this section.
This is... _ok_. I think the main caveat here is that the app might be uninstalling or having some other in-progress operation. However, given that we are seeing browser windows that [seem to filter out any actively closing ones](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/browser_window/internal/browser_window_interface_iterator_non_android.cc;l=37?q=ForEachCurrentBrowserWindowInterfaceOrderedByActivation&ss=chromium), this is likely safe.
Maybe add
```
// This is safe access for our use-case, as we are only using then when
// encountering a browser with an AppBrowserController, which means that an app
// is installed here, at least for now.
```
IN_PROC_BROWSER_TEST_F(FocusHandlerWebAppBrowserTest,
you should add a test that triggers a browser close asynchronously, and then tries to do the focus. The code that
}
we also need to make sure this is a WebAppBrowserController - you can use the `AsWebAppBrowserController()` method. If it returns a nullptr, then skip this browser.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks for the feedback, @dmu...@chromium.org! uploaded a new PS addressing all your comments — could you give it a quick look when you get a chance (even though you already gave a CR+1)?
web_app::WebAppProvider* provider =
web_app::WebAppProvider::GetForWebApps(&profile);
web_app::WebAppRegistrar* registrar =
provider ? &provider->registrar_unsafe() : nullptr;
Daniel MurphyI'm not familiar enough with this code to be sure if this is the correct usage. Adding @dmu...@chromium.org to review this section.
This is... _ok_. I think the main caveat here is that the app might be uninstalling or having some other in-progress operation. However, given that we are seeing browser windows that [seem to filter out any actively closing ones](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/browser_window/internal/browser_window_interface_iterator_non_android.cc;l=37?q=ForEachCurrentBrowserWindowInterfaceOrderedByActivation&ss=chromium), this is likely safe.
Maybe add
```
// This is safe access for our use-case, as we are only using then when
// encountering a browser with an AppBrowserController, which means that an app
// is installed here, at least for now.
```
Done
you should add a test that triggers a browser close asynchronously, and then tries to do the focus. The code that
Done
we also need to make sure this is a WebAppBrowserController - you can use the `AsWebAppBrowserController()` method. If it returns a nullptr, then skip this browser.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |