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 <string> | 9 #include <string> |
10 | 10 |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 case NEW_TAB: | 436 case NEW_TAB: |
437 if (key_code == ui::VKEY_T && shell->delegate()) | 437 if (key_code == ui::VKEY_T && shell->delegate()) |
438 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEWTAB_T); | 438 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEWTAB_T); |
439 return HandleNewTab(); | 439 return HandleNewTab(); |
440 case NEW_WINDOW: | 440 case NEW_WINDOW: |
441 return HandleNewWindow(false /* is_incognito */); | 441 return HandleNewWindow(false /* is_incognito */); |
442 case RESTORE_TAB: | 442 case RESTORE_TAB: |
443 return HandleRestoreTab(); | 443 return HandleRestoreTab(); |
444 case TAKE_SCREENSHOT: | 444 case TAKE_SCREENSHOT: |
445 case TAKE_SCREENSHOT_BY_PRTSCN_KEY: | 445 case TAKE_SCREENSHOT_BY_PRTSCN_KEY: |
446 if (screenshot_delegate_.get()) { | 446 if (screenshot_delegate_.get() && |
| 447 screenshot_delegate_->CanTakeScreenshot()) { |
447 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 448 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
448 for (size_t i = 0; i < root_windows.size(); ++i) | 449 for (size_t i = 0; i < root_windows.size(); ++i) |
449 screenshot_delegate_->HandleTakeScreenshot(root_windows[i]); | 450 screenshot_delegate_->HandleTakeScreenshot(root_windows[i]); |
450 } | 451 } |
451 // Return true to prevent propagation of the key event. | 452 // Return true to prevent propagation of the key event. |
452 return true; | 453 return true; |
453 case TAKE_PARTIAL_SCREENSHOT: | 454 case TAKE_PARTIAL_SCREENSHOT: |
454 if (screenshot_delegate_.get()) | 455 if (screenshot_delegate_.get()) |
455 ash::Shell::GetInstance()->delegate()-> | 456 ash::Shell::GetInstance()->delegate()-> |
456 StartPartialScreenshot(screenshot_delegate_.get()); | 457 StartPartialScreenshot(screenshot_delegate_.get()); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // Then set this one as active. | 737 // Then set this one as active. |
737 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); | 738 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); |
738 } | 739 } |
739 } | 740 } |
740 | 741 |
741 bool AcceleratorController::CanHandleAccelerators() const { | 742 bool AcceleratorController::CanHandleAccelerators() const { |
742 return true; | 743 return true; |
743 } | 744 } |
744 | 745 |
745 } // namespace ash | 746 } // namespace ash |
OLD | NEW |