Commit a5e63505 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Notify theme change for all PWAs, not just tabbed

See crbug.com/1106284#c1 for screen shots.

If a PWA is showing the download shelf when it navigates away and the
theme changes, we must notify that the theme has changed in order to
redraw the download shelf correctly. This is required for all PWAs,
not just those with tab strips.

Bug: 1106284
Change-Id: I43a18cb578ee9ef8870a7bc602b373b16c3c52a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2306492
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790563}
parent 069bd649
...@@ -94,7 +94,14 @@ enum class ShowTranslateBubbleResult { ...@@ -94,7 +94,14 @@ enum class ShowTranslateBubbleResult {
EDITABLE_FIELD_IS_ACTIVE, EDITABLE_FIELD_IS_ACTIVE,
}; };
enum class BrowserThemeChangeType { kBrowserTheme, kNativeTheme }; enum class BrowserThemeChangeType {
// User changes the browser theme.
kBrowserTheme,
// User changes the OS native theme.
kNativeTheme,
// A web app sets a theme color at launch, or changes theme color.
kWebAppTheme
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// BrowserWindow interface // BrowserWindow interface
......
...@@ -1747,6 +1747,13 @@ void BrowserView::ConfirmBrowserCloseWithPendingDownloads( ...@@ -1747,6 +1747,13 @@ void BrowserView::ConfirmBrowserCloseWithPendingDownloads(
} }
void BrowserView::UserChangedTheme(BrowserThemeChangeType theme_change_type) { void BrowserView::UserChangedTheme(BrowserThemeChangeType theme_change_type) {
// kWebAppTheme is triggered by web apps and will only change colors, not the
// frame type; just refresh the theme on all views in the browser window.
if (theme_change_type == BrowserThemeChangeType::kWebAppTheme) {
GetWidget()->ThemeChanged();
return;
}
// When the browser theme changes, the NativeTheme may also change. // When the browser theme changes, the NativeTheme may also change.
// In Incognito, the usage of dark or normal hinges on the browser theme. // In Incognito, the usage of dark or normal hinges on the browser theme.
if (theme_change_type == BrowserThemeChangeType::kBrowserTheme && if (theme_change_type == BrowserThemeChangeType::kBrowserTheme &&
......
...@@ -381,13 +381,7 @@ void AppBrowserController::DidChangeThemeColor() { ...@@ -381,13 +381,7 @@ void AppBrowserController::DidChangeThemeColor() {
return; return;
last_theme_color_ = theme_color; last_theme_color_ = theme_color;
UpdateThemePack(); UpdateThemePack();
browser_->window()->UpdateFrameColor(); browser_->window()->UserChangedTheme(BrowserThemeChangeType::kWebAppTheme);
if (has_tab_strip_) {
// TODO(crbug.com/1020050): Add separate change type for this situation, on
// Windows this causes the frame to be recreated which is visually
// disruptive.
browser_->window()->UserChangedTheme(BrowserThemeChangeType::kBrowserTheme);
}
} }
base::Optional<SkColor> AppBrowserController::GetThemeColor() const { base::Optional<SkColor> AppBrowserController::GetThemeColor() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment