Commit 2b116b4d authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Accessibility checks shelf crash fix

Bug: 819350
Change-Id: I244117aa25f5da865af5d3d8492079337b3f9696
Reviewed-on: https://chromium-review.googlesource.com/964244
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543819}
parent 39dbf282
...@@ -76,6 +76,7 @@ void Shelf::CreateShelfWidget(aura::Window* root) { ...@@ -76,6 +76,7 @@ void Shelf::CreateShelfWidget(aura::Window* root) {
aura::Window* shelf_container = aura::Window* shelf_container =
root->GetChildById(kShellWindowId_ShelfContainer); root->GetChildById(kShellWindowId_ShelfContainer);
shelf_widget_.reset(new ShelfWidget(shelf_container, this)); shelf_widget_.reset(new ShelfWidget(shelf_container, this));
shelf_widget_->Initialize();
DCHECK(!shelf_layout_manager_); DCHECK(!shelf_layout_manager_);
shelf_layout_manager_ = shelf_widget_->shelf_layout_manager(); shelf_layout_manager_ = shelf_widget_->shelf_layout_manager();
......
...@@ -212,9 +212,6 @@ ShelfWidget::ShelfWidget(aura::Window* shelf_container, Shelf* shelf) ...@@ -212,9 +212,6 @@ ShelfWidget::ShelfWidget(aura::Window* shelf_container, Shelf* shelf)
// Calls back into |this| and depends on |shelf_view_|. // Calls back into |this| and depends on |shelf_view_|.
background_animator_.AddObserver(this); background_animator_.AddObserver(this);
background_animator_.AddObserver(delegate_view_); background_animator_.AddObserver(delegate_view_);
// Sets initial session state to make sure the UI is properly shown.
OnSessionStateChanged(Shell::Get()->session_controller()->GetSessionState());
} }
ShelfWidget::~ShelfWidget() { ShelfWidget::~ShelfWidget() {
...@@ -222,6 +219,11 @@ ShelfWidget::~ShelfWidget() { ...@@ -222,6 +219,11 @@ ShelfWidget::~ShelfWidget() {
DCHECK(!status_area_widget_); DCHECK(!status_area_widget_);
} }
void ShelfWidget::Initialize() {
// Sets initial session state to make sure the UI is properly shown.
OnSessionStateChanged(Shell::Get()->session_controller()->GetSessionState());
}
void ShelfWidget::Shutdown() { void ShelfWidget::Shutdown() {
// Shutting down the status area widget may cause some widgets (e.g. bubbles) // Shutting down the status area widget may cause some widgets (e.g. bubbles)
// to close, so uninstall the ShelfLayoutManager event filters first. Don't // to close, so uninstall the ShelfLayoutManager event filters first. Don't
......
...@@ -43,6 +43,12 @@ class ASH_EXPORT ShelfWidget : public views::Widget, ...@@ -43,6 +43,12 @@ class ASH_EXPORT ShelfWidget : public views::Widget,
ShelfWidget(aura::Window* shelf_container, Shelf* shelf); ShelfWidget(aura::Window* shelf_container, Shelf* shelf);
~ShelfWidget() override; ~ShelfWidget() override;
// Sets the initial session state and show the UI. Not part of the constructor
// because showing the UI triggers the accessibility checks in browser_tests,
// which will crash unless the constructor returns, allowing the caller
// to store the constructed widget.
void Initialize();
// Clean up prior to deletion. // Clean up prior to deletion.
void Shutdown(); void Shutdown();
......
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