| 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 const ui::EventType previous_event_type = | 483 const ui::EventType previous_event_type = |
| 484 context_.previous_accelerator().type(); | 484 context_.previous_accelerator().type(); |
| 485 const ui::KeyboardCode previous_key_code = | 485 const ui::KeyboardCode previous_key_code = |
| 486 context_.previous_accelerator().key_code(); | 486 context_.previous_accelerator().key_code(); |
| 487 | 487 |
| 488 // You *MUST* return true when some action is performed. Otherwise, this | 488 // You *MUST* return true when some action is performed. Otherwise, this |
| 489 // function might be called *twice*, via BrowserView::PreHandleKeyboardEvent | 489 // function might be called *twice*, via BrowserView::PreHandleKeyboardEvent |
| 490 // and BrowserView::HandleKeyboardEvent, for a single accelerator press. | 490 // and BrowserView::HandleKeyboardEvent, for a single accelerator press. |
| 491 switch (action) { | 491 switch (action) { |
| 492 case CYCLE_BACKWARD_MRU: | 492 case CYCLE_BACKWARD_MRU: |
| 493 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) { |
| 494 shell->delegate()->RecordUserMetricsAction( |
| 495 UMA_ACCEL_PREVWINDOW_F5); |
| 496 } |
| 493 if (key_code == ui::VKEY_TAB) | 497 if (key_code == ui::VKEY_TAB) |
| 494 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_TAB); | 498 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_TAB); |
| 495 return HandleCycleWindowMRU(WindowCycleController::BACKWARD, | 499 return HandleCycleWindowMRU(WindowCycleController::BACKWARD, |
| 496 accelerator.IsAltDown()); | 500 accelerator.IsAltDown()); |
| 497 case CYCLE_FORWARD_MRU: | 501 case CYCLE_FORWARD_MRU: |
| 502 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) { |
| 503 shell->delegate()->RecordUserMetricsAction( |
| 504 UMA_ACCEL_NEXTWINDOW_F5); |
| 505 } |
| 498 if (key_code == ui::VKEY_TAB) | 506 if (key_code == ui::VKEY_TAB) |
| 499 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_TAB); | 507 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_TAB); |
| 500 return HandleCycleWindowMRU(WindowCycleController::FORWARD, | 508 return HandleCycleWindowMRU(WindowCycleController::FORWARD, |
| 501 accelerator.IsAltDown()); | 509 accelerator.IsAltDown()); |
| 502 case CYCLE_BACKWARD_LINEAR: | 510 case CYCLE_BACKWARD_LINEAR: |
| 503 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) | 511 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) |
| 504 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_F5); | 512 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_F5); |
| 505 HandleCycleWindowLinear(CYCLE_BACKWARD); | 513 HandleCycleWindowLinear(CYCLE_BACKWARD); |
| 506 return true; | 514 return true; |
| 507 case CYCLE_FORWARD_LINEAR: | 515 case CYCLE_FORWARD_LINEAR: |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 keyboard_brightness_control_delegate) { | 924 keyboard_brightness_control_delegate) { |
| 917 keyboard_brightness_control_delegate_ = | 925 keyboard_brightness_control_delegate_ = |
| 918 keyboard_brightness_control_delegate.Pass(); | 926 keyboard_brightness_control_delegate.Pass(); |
| 919 } | 927 } |
| 920 | 928 |
| 921 bool AcceleratorController::CanHandleAccelerators() const { | 929 bool AcceleratorController::CanHandleAccelerators() const { |
| 922 return true; | 930 return true; |
| 923 } | 931 } |
| 924 | 932 |
| 925 } // namespace ash | 933 } // namespace ash |
| OLD | NEW |