Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 2858583002: Fix crash when pressing stylus tools accelerator with null PaletteTray. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/accelerators/accelerator_commands.h" 9 #include "ash/accelerators/accelerator_commands.h"
10 #include "ash/accelerators/accelerator_controller_delegate.h" 10 #include "ash/accelerators/accelerator_controller_delegate.h"
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 return Shell::Get()->session_controller()->CanLockScreen(); 501 return Shell::Get()->session_controller()->CanLockScreen();
502 } 502 }
503 503
504 void HandleLock() { 504 void HandleLock() {
505 base::RecordAction(UserMetricsAction("Accel_LockScreen_L")); 505 base::RecordAction(UserMetricsAction("Accel_LockScreen_L"));
506 Shell::Get()->session_controller()->LockScreen(); 506 Shell::Get()->session_controller()->LockScreen();
507 } 507 }
508 508
509 void HandleShowStylusTools() { 509 void HandleShowStylusTools() {
510 base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools")); 510 base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools"));
511 511 Shell::GetWmRootWindowForNewWindows()
512 RootWindowController* root_window_controller = 512 ->GetRootWindowController()
513 Shell::GetWmRootWindowForNewWindows()->GetRootWindowController(); 513 ->GetShelf()
514 StatusAreaWidget* status_area_widget = 514 ->GetStatusAreaWidget()
515 root_window_controller->GetShelf()->GetStatusAreaWidget(); 515 ->palette_tray()
516 // Tests (clusterfuzz) can trigger this before the status area is ready. 516 ->ShowPalette();
517 if (status_area_widget)
518 status_area_widget->palette_tray()->ShowPalette();
519 } 517 }
520 518
521 bool CanHandleShowStylusTools() { 519 bool CanHandleShowStylusTools() {
522 return Shell::Get()->palette_delegate() && 520 StatusAreaWidget* status_area_widget = Shell::GetWmRootWindowForNewWindows()
521 ->GetRootWindowController()
522 ->GetShelf()
523 ->GetStatusAreaWidget();
524 // Tests (clusterfuzz) can trigger this before the status area is ready.
525 return status_area_widget && status_area_widget->palette_tray() &&
526 Shell::Get()->palette_delegate() &&
523 Shell::Get()->palette_delegate()->ShouldShowPalette(); 527 Shell::Get()->palette_delegate()->ShouldShowPalette();
524 } 528 }
525 529
526 void HandleSuspend() { 530 void HandleSuspend() {
527 base::RecordAction(UserMetricsAction("Accel_Suspend")); 531 base::RecordAction(UserMetricsAction("Accel_Suspend"));
528 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend(); 532 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend();
529 } 533 }
530 534
531 bool CanHandleCycleUser() { 535 bool CanHandleCycleUser() {
532 return Shell::Get()->shell_delegate()->IsMultiProfilesEnabled() && 536 return Shell::Get()->shell_delegate()->IsMultiProfilesEnabled() &&
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 data->uma_histogram_name, data->notification_message_id, 1307 data->uma_histogram_name, data->notification_message_id,
1304 data->old_shortcut_id, data->new_shortcut_id); 1308 data->old_shortcut_id, data->new_shortcut_id);
1305 1309
1306 if (!data->deprecated_enabled) 1310 if (!data->deprecated_enabled)
1307 return AcceleratorProcessingStatus::STOP; 1311 return AcceleratorProcessingStatus::STOP;
1308 1312
1309 return AcceleratorProcessingStatus::PROCEED; 1313 return AcceleratorProcessingStatus::PROCEED;
1310 } 1314 }
1311 1315
1312 } // namespace ash 1316 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698