Commit be86e8ab authored by estade's avatar estade Committed by Commit bot

Fix crash when pressing stylus tools accelerator with null PaletteTray.

BUG=717422

Review-Url: https://codereview.chromium.org/2858583002
Cr-Commit-Position: refs/heads/master@{#468651}
parent 2d76b52e
...@@ -508,18 +508,22 @@ void HandleLock() { ...@@ -508,18 +508,22 @@ void HandleLock() {
void HandleShowStylusTools() { void HandleShowStylusTools() {
base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools")); base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools"));
Shell::GetWmRootWindowForNewWindows()
RootWindowController* root_window_controller = ->GetRootWindowController()
Shell::GetWmRootWindowForNewWindows()->GetRootWindowController(); ->GetShelf()
StatusAreaWidget* status_area_widget = ->GetStatusAreaWidget()
root_window_controller->GetShelf()->GetStatusAreaWidget(); ->palette_tray()
// Tests (clusterfuzz) can trigger this before the status area is ready. ->ShowPalette();
if (status_area_widget)
status_area_widget->palette_tray()->ShowPalette();
} }
bool CanHandleShowStylusTools() { bool CanHandleShowStylusTools() {
return Shell::Get()->palette_delegate() && StatusAreaWidget* status_area_widget = Shell::GetWmRootWindowForNewWindows()
->GetRootWindowController()
->GetShelf()
->GetStatusAreaWidget();
// Tests (clusterfuzz) can trigger this before the status area is ready.
return status_area_widget && status_area_widget->palette_tray() &&
Shell::Get()->palette_delegate() &&
Shell::Get()->palette_delegate()->ShouldShowPalette(); Shell::Get()->palette_delegate()->ShouldShowPalette();
} }
......
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