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

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

Issue 10827021: Open app with Alt+number even when it is not running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« 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 <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 10
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 items[i].type != TYPE_BROWSER_SHORTCUT) { 708 items[i].type != TYPE_BROWSER_SHORTCUT) {
709 found_index = i; 709 found_index = i;
710 indexes_left--; 710 indexes_left--;
711 } 711 }
712 } 712 }
713 713
714 // There are two ways how found_index can be valid: a.) the nth item was 714 // There are two ways how found_index can be valid: a.) the nth item was
715 // found (which is true when indexes_left is -1) or b.) the last item was 715 // found (which is true when indexes_left is -1) or b.) the last item was
716 // requested (which is true when index was passed in as a negative number). 716 // requested (which is true when index was passed in as a negative number).
717 if (found_index >= 0 && (indexes_left == -1 || window < 0) && 717 if (found_index >= 0 && (indexes_left == -1 || window < 0) &&
718 items[found_index].status == ash::STATUS_RUNNING) { 718 (items[found_index].status == ash::STATUS_RUNNING ||
719 items[found_index].status == ash::STATUS_CLOSED)) {
719 // Then set this one as active. 720 // Then set this one as active.
720 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); 721 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index);
721 } 722 }
722 } 723 }
723 724
724 void AcceleratorController::RegisterAccelerators( 725 void AcceleratorController::RegisterAccelerators(
725 const AcceleratorData accelerators[], 726 const AcceleratorData accelerators[],
726 size_t accelerators_length) { 727 size_t accelerators_length) {
727 for (size_t i = 0; i < accelerators_length; ++i) { 728 for (size_t i = 0; i < accelerators_length; ++i) {
728 ui::Accelerator accelerator(accelerators[i].keycode, 729 ui::Accelerator accelerator(accelerators[i].keycode,
729 accelerators[i].modifiers); 730 accelerators[i].modifiers);
730 accelerator.set_type(accelerators[i].trigger_on_press ? 731 accelerator.set_type(accelerators[i].trigger_on_press ?
731 ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED); 732 ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED);
732 Register(accelerator, this); 733 Register(accelerator, this);
733 accelerators_.insert( 734 accelerators_.insert(
734 std::make_pair(accelerator, accelerators[i].action)); 735 std::make_pair(accelerator, accelerators[i].action));
735 } 736 }
736 } 737 }
737 738
738 bool AcceleratorController::CanHandleAccelerators() const { 739 bool AcceleratorController::CanHandleAccelerators() const {
739 return true; 740 return true;
740 } 741 }
741 742
742 } // namespace ash 743 } // 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