| OLD | NEW |
| 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 AcceleratorController::AcceleratorController() | 370 AcceleratorController::AcceleratorController() |
| 371 : accelerator_manager_(new ui::AcceleratorManager) { | 371 : accelerator_manager_(new ui::AcceleratorManager) { |
| 372 Init(); | 372 Init(); |
| 373 } | 373 } |
| 374 | 374 |
| 375 AcceleratorController::~AcceleratorController() { | 375 AcceleratorController::~AcceleratorController() { |
| 376 } | 376 } |
| 377 | 377 |
| 378 void AcceleratorController::Init() { | 378 void AcceleratorController::Init() { |
| 379 exit_warning_handler_.Init(context()); |
| 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]); |
| 382 actions_allowed_at_lock_screen_.insert( | 383 actions_allowed_at_lock_screen_.insert( |
| 383 kActionsAllowedAtLoginOrLockScreen[i]); | 384 kActionsAllowedAtLoginOrLockScreen[i]); |
| 384 } | 385 } |
| 385 for (size_t i = 0; i < kActionsAllowedAtLockScreenLength; ++i) | 386 for (size_t i = 0; i < kActionsAllowedAtLockScreenLength; ++i) |
| 386 actions_allowed_at_lock_screen_.insert(kActionsAllowedAtLockScreen[i]); | 387 actions_allowed_at_lock_screen_.insert(kActionsAllowedAtLockScreen[i]); |
| 387 for (size_t i = 0; i < kActionsAllowedAtModalWindowLength; ++i) | 388 for (size_t i = 0; i < kActionsAllowedAtModalWindowLength; ++i) |
| 388 actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]); | 389 actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |