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

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

Issue 10878058: Move functions for controlling Caps Lock to CapsLockDelegate from SystemTrayDelegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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
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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_SEARCH_LWIN); 485 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_SEARCH_LWIN);
486 // When spoken feedback is enabled, we should neither toggle the list nor 486 // When spoken feedback is enabled, we should neither toggle the list nor
487 // consume the key since Search+Shift is one of the shortcuts the a11y 487 // consume the key since Search+Shift is one of the shortcuts the a11y
488 // feature uses. crbug.com/132296 488 // feature uses. crbug.com/132296
489 DCHECK_EQ(ui::VKEY_LWIN, accelerator.key_code()); 489 DCHECK_EQ(ui::VKEY_LWIN, accelerator.key_code());
490 if (Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) 490 if (Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled())
491 return false; 491 return false;
492 ash::Shell::GetInstance()->ToggleAppList(); 492 ash::Shell::GetInstance()->ToggleAppList();
493 return true; 493 return true;
494 case DISABLE_CAPS_LOCK: 494 case DISABLE_CAPS_LOCK:
495 // TODO(mazda): Handle this using |caps_lock_delegate_|. 495 if (shell->caps_lock_delegate()->IsCapsLockEnabled())
496 if (shell->tray_delegate()->IsCapsLockOn()) 496 shell->caps_lock_delegate()->SetCapsLockEnabled(false);
497 shell->tray_delegate()->SetCapsLockEnabled(false);
498 return true; 497 return true;
499 case TOGGLE_CAPS_LOCK: 498 case TOGGLE_CAPS_LOCK:
500 if (caps_lock_delegate_.get()) 499 shell->caps_lock_delegate()->ToggleCapsLock();
501 return caps_lock_delegate_->HandleToggleCapsLock(); 500 return true;
502 break;
503 case BRIGHTNESS_DOWN: 501 case BRIGHTNESS_DOWN:
504 if (brightness_control_delegate_.get()) 502 if (brightness_control_delegate_.get())
505 return brightness_control_delegate_->HandleBrightnessDown(accelerator); 503 return brightness_control_delegate_->HandleBrightnessDown(accelerator);
506 break; 504 break;
507 case BRIGHTNESS_UP: 505 case BRIGHTNESS_UP:
508 if (brightness_control_delegate_.get()) 506 if (brightness_control_delegate_.get())
509 return brightness_control_delegate_->HandleBrightnessUp(accelerator); 507 return brightness_control_delegate_->HandleBrightnessUp(accelerator);
510 break; 508 break;
511 case KEYBOARD_BRIGHTNESS_DOWN: 509 case KEYBOARD_BRIGHTNESS_DOWN:
512 if (keyboard_brightness_control_delegate_.get()) 510 if (keyboard_brightness_control_delegate_.get())
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 NOTREACHED() << "Unhandled action " << action; 694 NOTREACHED() << "Unhandled action " << action;
697 } 695 }
698 return false; 696 return false;
699 } 697 }
700 698
701 void AcceleratorController::SetBrightnessControlDelegate( 699 void AcceleratorController::SetBrightnessControlDelegate(
702 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate) { 700 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate) {
703 brightness_control_delegate_.swap(brightness_control_delegate); 701 brightness_control_delegate_.swap(brightness_control_delegate);
704 } 702 }
705 703
706 void AcceleratorController::SetCapsLockDelegate(
707 scoped_ptr<CapsLockDelegate> caps_lock_delegate) {
708 caps_lock_delegate_.swap(caps_lock_delegate);
709 }
710
711 void AcceleratorController::SetImeControlDelegate( 704 void AcceleratorController::SetImeControlDelegate(
712 scoped_ptr<ImeControlDelegate> ime_control_delegate) { 705 scoped_ptr<ImeControlDelegate> ime_control_delegate) {
713 ime_control_delegate_.swap(ime_control_delegate); 706 ime_control_delegate_.swap(ime_control_delegate);
714 } 707 }
715 708
716 void AcceleratorController::SetKeyboardBrightnessControlDelegate( 709 void AcceleratorController::SetKeyboardBrightnessControlDelegate(
717 scoped_ptr<KeyboardBrightnessControlDelegate> 710 scoped_ptr<KeyboardBrightnessControlDelegate>
718 keyboard_brightness_control_delegate) { 711 keyboard_brightness_control_delegate) {
719 keyboard_brightness_control_delegate_.swap( 712 keyboard_brightness_control_delegate_.swap(
720 keyboard_brightness_control_delegate); 713 keyboard_brightness_control_delegate);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 accelerators_.insert( 770 accelerators_.insert(
778 std::make_pair(accelerator, accelerators[i].action)); 771 std::make_pair(accelerator, accelerators[i].action));
779 } 772 }
780 } 773 }
781 774
782 bool AcceleratorController::CanHandleAccelerators() const { 775 bool AcceleratorController::CanHandleAccelerators() const {
783 return true; 776 return true;
784 } 777 }
785 778
786 } // namespace ash 779 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.h ('k') | ash/accelerators/accelerator_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698