Commit 7ecdacb0 authored by Tim Song's avatar Tim Song Committed by Commit Bot

Ash Tray: Fix crash when toggling mirror mode display.

The DictationButtonTray is updating its visibility in the constructor, which
causes a crash now that we have more complicated visibility logic. Instead move
the visibility update to the Initialize() function.

TEST=manually verified on device
BUG=1036052

Change-Id: I887a47ac2a655994b99d438df1b644d8fe75fd98
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1976857Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Commit-Queue: Tim Song <tengs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726967}
parent a244d3ed
......@@ -23,8 +23,6 @@ namespace ash {
DictationButtonTray::DictationButtonTray(Shelf* shelf)
: TrayBackgroundView(shelf), icon_(new views::ImageView()) {
UpdateVisibility();
off_image_ = gfx::CreateVectorIcon(kDictationOffNewuiIcon,
ShelfConfig::Get()->shelf_icon_color());
on_image_ = gfx::CreateVectorIcon(kDictationOnNewuiIcon,
......@@ -54,6 +52,11 @@ bool DictationButtonTray::PerformAction(const ui::Event& event) {
return true;
}
void DictationButtonTray::Initialize() {
TrayBackgroundView::Initialize();
UpdateVisibility();
}
void DictationButtonTray::ClickedOutsideBubble() {}
void DictationButtonTray::OnDictationStarted() {
......
......@@ -42,6 +42,7 @@ class ASH_EXPORT DictationButtonTray : public TrayBackgroundView,
void OnAccessibilityStatusChanged() override;
// TrayBackgroundView:
void Initialize() override;
void ClickedOutsideBubble() override;
base::string16 GetAccessibleNameForTray() override;
void HideBubbleWithView(const TrayBubbleView* bubble_view) override;
......
......@@ -516,6 +516,9 @@ bool TrayBackgroundView::GetEffectiveVisibility() {
if (!visible_preferred_)
return false;
if (!GetWidget())
return false;
// When the status area is collapsed, the effective visibility of the view is
// determined by |show_when_collapsed_|.
StatusAreaWidget::CollapseState collapse_state =
......
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