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

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

Issue 14771027: Unify and change logout/sleep/lock shortcuts (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: update Created 7 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
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 <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <iostream> 9 #include <iostream>
10 #include <string> 10 #include <string>
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 void AcceleratorControllerContext::UpdateContext( 361 void AcceleratorControllerContext::UpdateContext(
362 const ui::Accelerator& accelerator) { 362 const ui::Accelerator& accelerator) {
363 previous_accelerator_ = current_accelerator_; 363 previous_accelerator_ = current_accelerator_;
364 current_accelerator_ = accelerator; 364 current_accelerator_ = accelerator;
365 } 365 }
366 366
367 //////////////////////////////////////////////////////////////////////////////// 367 ////////////////////////////////////////////////////////////////////////////////
368 // AcceleratorController, public: 368 // AcceleratorController, public:
369 369
370 AcceleratorController::AcceleratorController() 370 AcceleratorController::AcceleratorController()
371 : accelerator_manager_(new ui::AcceleratorManager) { 371 : accelerator_manager_(new ui::AcceleratorManager),
372 exit_warning_handler_(&context_) {
372 Init(); 373 Init();
373 } 374 }
374 375
375 AcceleratorController::~AcceleratorController() { 376 AcceleratorController::~AcceleratorController() {
376 } 377 }
377 378
378 void AcceleratorController::Init() { 379 void AcceleratorController::Init() {
379 for (size_t i = 0; i < kActionsAllowedAtLoginOrLockScreenLength; ++i) { 380 for (size_t i = 0; i < kActionsAllowedAtLoginOrLockScreenLength; ++i) {
380 actions_allowed_at_login_screen_.insert( 381 actions_allowed_at_login_screen_.insert(
381 kActionsAllowedAtLoginOrLockScreen[i]); 382 kActionsAllowedAtLoginOrLockScreen[i]);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 } 571 }
571 return false; 572 return false;
572 } 573 }
573 case DISABLE_GPU_WATCHDOG: 574 case DISABLE_GPU_WATCHDOG:
574 content::GpuDataManager::GetInstance()->DisableGpuWatchdog(); 575 content::GpuDataManager::GetInstance()->DisableGpuWatchdog();
575 return true; 576 return true;
576 #endif 577 #endif
577 case OPEN_FEEDBACK_PAGE: 578 case OPEN_FEEDBACK_PAGE:
578 ash::Shell::GetInstance()->delegate()->OpenFeedbackPage(); 579 ash::Shell::GetInstance()->delegate()->OpenFeedbackPage();
579 return true; 580 return true;
580 case EXIT_PRESSED: 581 case EXIT:
581 case EXIT_RELEASED: 582 exit_warning_handler_.HandleAccelerator();
582 exit_warning_handler_.HandleExitKey(action == EXIT_PRESSED);
583 return true; 583 return true;
584 case NEW_INCOGNITO_WINDOW: 584 case NEW_INCOGNITO_WINDOW:
585 Shell::GetInstance()->delegate()->NewWindow(true /* is_incognito */); 585 Shell::GetInstance()->delegate()->NewWindow(true /* is_incognito */);
586 return true; 586 return true;
587 case NEW_TAB: 587 case NEW_TAB:
588 if (key_code == ui::VKEY_T) 588 if (key_code == ui::VKEY_T)
589 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEWTAB_T); 589 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEWTAB_T);
590 Shell::GetInstance()->delegate()->NewTab(); 590 Shell::GetInstance()->delegate()->NewTab();
591 return true; 591 return true;
592 case NEW_WINDOW: 592 case NEW_WINDOW:
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 keyboard_brightness_control_delegate) { 961 keyboard_brightness_control_delegate) {
962 keyboard_brightness_control_delegate_ = 962 keyboard_brightness_control_delegate_ =
963 keyboard_brightness_control_delegate.Pass(); 963 keyboard_brightness_control_delegate.Pass();
964 } 964 }
965 965
966 bool AcceleratorController::CanHandleAccelerators() const { 966 bool AcceleratorController::CanHandleAccelerators() const {
967 return true; 967 return true;
968 } 968 }
969 969
970 } // namespace ash 970 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698