Commit 902a007c authored by Bret Sepulveda's avatar Bret Sepulveda Committed by Commit Bot

Fix single tab mode damage being incorrect after uninstalling a theme.

When BrowserNonClientFrameView is destroyed and recreated, for example
when the user installs or uninstalls a theme, the BrowserView is reused.
But the Tabstrip was only being observed on BrowserView creation.

This is probably a very old bug, but it's hard to observe the effects
without single tab mode. In particular, I found that the profile
switcher chip can get out of sync with the size of the tabstrip and
overlap the new tab button, which is also fixed.

Bug: 841643
Change-Id: Ia3c20a70f8082e1a8b90d34da35011313c344035
Reviewed-on: https://chromium-review.googlesource.com/1079958Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563080}
parent 73e67ee5
......@@ -52,6 +52,7 @@ BrowserNonClientFrameView::BrowserNonClientFrameView(BrowserFrame* frame,
g_browser_process->profile_manager()->
GetProfileAttributesStorage().AddObserver(this);
}
MaybeObserveTabstrip();
}
BrowserNonClientFrameView::~BrowserNonClientFrameView() {
......@@ -68,10 +69,7 @@ int BrowserNonClientFrameView::GetAvatarIconPadding() {
}
void BrowserNonClientFrameView::OnBrowserViewInitViewsComplete() {
if (browser_view()->tabstrip()) {
DCHECK(!tab_strip_observer_.IsObserving(browser_view()->tabstrip()));
tab_strip_observer_.Add(browser_view()->tabstrip());
}
MaybeObserveTabstrip();
UpdateMinimumSize();
}
......@@ -422,6 +420,13 @@ void BrowserNonClientFrameView::OnProfileHighResAvatarLoaded(
UpdateTaskbarDecoration();
}
void BrowserNonClientFrameView::MaybeObserveTabstrip() {
if (browser_view()->tabstrip()) {
DCHECK(!tab_strip_observer_.IsObserving(browser_view()->tabstrip()));
tab_strip_observer_.Add(browser_view()->tabstrip());
}
}
const ui::ThemeProvider*
BrowserNonClientFrameView::GetThemeProviderForProfile() const {
// Because the frame's accessor reads the ThemeProvider from the profile and
......
......@@ -149,6 +149,8 @@ class BrowserNonClientFrameView : public views::NonClientFrameView,
void OnProfileHighResAvatarLoaded(
const base::FilePath& profile_path) override;
void MaybeObserveTabstrip();
// Gets a theme provider that should be non-null even before we're added to a
// view hierarchy.
const ui::ThemeProvider* GetThemeProviderForProfile() 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