Commit-Queue | +1 |
std::string GetTitleForMediaControls(
@sk...@chromium.org do you think this is fine to override here, or should we create our own `WebContentsDelegate` to override `GetTitleForMediaControls`?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Is it possible to plumb this via InitParams instead?
// If the url is for the Focus Mode media player, then we should display the
// playlist information.
if (web_contents->GetLastCommittedURL() ==
GURL(chrome::kChromeUIFocusModeMediaURL)) {
return ash::focus_mode_util::GetSourceTitleForMediaControls();
}
// Otherwise, preserve the default behavior.
return {};
Does this need to be dynamic? i.e. if we know this when the web view is created, we could pass it in via params instead of trying to look it up like this. This is too specific to focus mode for this class.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// If the url is for the Focus Mode media player, then we should display the
// playlist information.
if (web_contents->GetLastCommittedURL() ==
GURL(chrome::kChromeUIFocusModeMediaURL)) {
return ash::focus_mode_util::GetSourceTitleForMediaControls();
}
// Otherwise, preserve the default behavior.
return {};
Does this need to be dynamic? i.e. if we know this when the web view is created, we could pass it in via params instead of trying to look it up like this. This is too specific to focus mode for this class.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
std::string GetSourceTitleForMediaControls() {
Can this take the playlist as a parameter? Then you can test it without mocking everything.
std::string GetTitleForMediaControls(
@sk...@chromium.org do you think this is fine to override here, or should we create our own `WebContentsDelegate` to override `GetTitleForMediaControls`?
This is probably fine.
return params_.source_title;
I'm pretty sure this needs a fallback if its unset.
// If the url is for the Focus Mode media player, then we should display the
// playlist information.
if (web_contents->GetLastCommittedURL() ==
GURL(chrome::kChromeUIFocusModeMediaURL)) {
return ash::focus_mode_util::GetSourceTitleForMediaControls();
}
// Otherwise, preserve the default behavior.
return {};
Richard ChuiDoes this need to be dynamic? i.e. if we know this when the web view is created, we could pass it in via params instead of trying to look it up like this. This is too specific to focus mode for this class.
Done, how does this look?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
std::string GetTitleForMediaControls(
Sean Kau@sk...@chromium.org do you think this is fine to override here, or should we create our own `WebContentsDelegate` to override `GetTitleForMediaControls`?
This is probably fine.
Acknowledged
return params_.source_title;
I'm pretty sure this needs a fallback if its unset.
I don't think it does? The default behavior currently returns `{}`, and that should be what `source_title` is if unset, correct?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Can this take the playlist as a parameter? Then you can test it without mocking everything.
Done
Richard ChuiI'm pretty sure this needs a fallback if its unset.
I don't think it does? The default behavior currently returns `{}`, and that should be what `source_title` is if unset, correct?
Discussed offline, just for futureproofing we will return the parent behavior.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
lgtm % test. Thanks for addressing the comments.
TEST(FocusModeUtilTests, VerifySourceTitle) {
// Verify that missing `id` or invalid playlist type results in an empty
// string.
SelectedPlaylist selected_playlist;
EXPECT_TRUE(GetSourceTitleForMediaControls(selected_playlist).empty());
selected_playlist.id = "id0";
EXPECT_TRUE(GetSourceTitleForMediaControls(selected_playlist).empty());
// Verify that having a missing playlist title will still return the playlist
// type as a string.
selected_playlist.type = SoundType::kYouTubeMusic;
EXPECT_EQ(GetSourceTitleForMediaControls(selected_playlist), "YouTube Music");
// Verify a fully formed YTM string.
selected_playlist.title = "Playlist Title";
EXPECT_EQ(GetSourceTitleForMediaControls(selected_playlist),
"YouTube Music ᐧ Playlist Title");
// Verify a fully formed Soundscape string.
selected_playlist.type = SoundType::kSoundscape;
EXPECT_EQ(GetSourceTitleForMediaControls(selected_playlist),
"Focus sounds ᐧ Playlist Title");
}
This should be 4 separate tests
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Hi all, can I get an owners review?
jamescook@
pbond@
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
TEST(FocusModeUtilTests, VerifySourceTitle) {
// Verify that missing `id` or invalid playlist type results in an empty
// string.
SelectedPlaylist selected_playlist;
EXPECT_TRUE(GetSourceTitleForMediaControls(selected_playlist).empty());
selected_playlist.id = "id0";
EXPECT_TRUE(GetSourceTitleForMediaControls(selected_playlist).empty());
// Verify that having a missing playlist title will still return the playlist
// type as a string.
selected_playlist.type = SoundType::kYouTubeMusic;
EXPECT_EQ(GetSourceTitleForMediaControls(selected_playlist), "YouTube Music");
// Verify a fully formed YTM string.
selected_playlist.title = "Playlist Title";
EXPECT_EQ(GetSourceTitleForMediaControls(selected_playlist),
"YouTube Music ᐧ Playlist Title");
// Verify a fully formed Soundscape string.
selected_playlist.type = SoundType::kSoundscape;
EXPECT_EQ(GetSourceTitleForMediaControls(selected_playlist),
"Focus sounds ᐧ Playlist Title");
}
This should be 4 separate tests
Done
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
AshWebView::InitParams web_view_params;
web_view_params.rounded_corners =
gfx::RoundedCornersF(util().GetCornerRadius());
curtain_view_ =
AddChildView(AshWebViewFactory::Get()->Create(web_view_params));
Hi Richard,
Why do you need this code?
Also web_view_params are not being used afterwards, please make them either local or use std::move() to explicitly forbid further usage in the AddCurtainWebView() function.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
AshWebView::InitParams web_view_params;
web_view_params.rounded_corners =
gfx::RoundedCornersF(util().GetCornerRadius());
curtain_view_ =
AddChildView(AshWebViewFactory::Get()->Create(web_view_params));
Hi Richard,
Why do you need this code?
Also web_view_params are not being used afterwards, please make them either local or use std::move() to explicitly forbid further usage in the AddCurtainWebView() function.
This is because because updates to AshWebView now require it to have a defined constructor/destructor (since it’s now considered complex), so it is no longer an aggregate type.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Hi Xiyuan, can you do an owners review for:
a/p/c/ash_web_view
c/b/u/a/ash_web_view_impl
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
lgtm
InitParams(const InitParams&);
nit: Also add an assignment op. And devs might want it to be movable too.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +1 |
nit: Also add an assignment op. And devs might want it to be movable too.
Thanks for pointing this out, added!
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
lgtm
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |