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

Side by Side Diff: chrome/browser/ui/views/aura/caps_lock_handler.cc

Issue 9225004: Handle Caps Lock short cut (Shift+Search) in ash [part 2 of 2]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/aura/caps_lock_handler.h"
6
7 #include "content/public/browser/browser_thread.h"
8
9 // TODO(yusukes): Support ash on Windows.
10 #if defined(OS_CHROMEOS)
11 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
12 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
13 #include "chrome/browser/chromeos/system/runtime_environment.h"
14 #endif
15
16 CapsLockHandler::CapsLockHandler()
17 :
18 #if defined(OS_CHROMEOS)
19 is_running_on_chromeos_(
Daniel Erat 2012/01/18 15:44:31 nit: the lines in the initializer list should be i
Yusuke Sato 2012/01/23 06:53:49 Done.
20 chromeos::system::runtime_environment::IsRunningOnChromeOS()),
21 caps_lock_is_on_(chromeos::input_method::XKeyboard::CapsLockIsEnabled())
22 #else
23 is_running_on_chromeos_(false),
24 caps_lock_is_on_(false)
25 #endif
26 {
27 #if defined(OS_CHROMEOS)
28 chromeos::SystemKeyEventListener* system_event_listener
29 = chromeos::SystemKeyEventListener::GetInstance();
Daniel Erat 2012/01/18 15:44:31 nit: equals sign should be at end of previous line
Yusuke Sato 2012/01/23 06:53:49 Done.
30 // SystemKeyEventListener is instantiated only when running on Chrome OS.
Daniel Erat 2012/01/18 15:44:31 this comment doesn't exactly match the check. sho
Yusuke Sato 2012/01/23 06:53:49 Done.
31 DCHECK((!is_running_on_chromeos_) || system_event_listener);
Daniel Erat 2012/01/18 15:44:31 nit: remove extra parentheses around !is_running_o
Yusuke Sato 2012/01/23 06:53:49 Done.
32 if (system_event_listener)
33 system_event_listener->AddCapsLockObserver(this);
34 #endif
35 }
36
37 CapsLockHandler::~CapsLockHandler() {
38 #if defined(OS_CHROMEOS)
39 chromeos::SystemKeyEventListener* system_event_listener
40 = chromeos::SystemKeyEventListener::GetInstance();
Daniel Erat 2012/01/18 15:44:31 nit: move equals sign to previous line
Yusuke Sato 2012/01/23 06:53:49 Done.
41 if (system_event_listener)
42 system_event_listener->RemoveCapsLockObserver(this);
43 #endif
44 }
45
46 bool CapsLockHandler::HandleToggleCapsLock() {
47 #if defined(OS_CHROMEOS)
48 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
49 if (is_running_on_chromeos_) {
50 // TODO(yusukes): Do not change Caps Lock status and just return false if
51 // spoken feedback is enabled (crosbug.com/110127).
52 chromeos::input_method::InputMethodManager* input_method_manager =
53 chromeos::input_method::InputMethodManager::GetInstance();
54 input_method_manager->GetXKeyboard()->SetCapsLockEnabled(!caps_lock_is_on_);
55 return true; // consume the short cut key.
56 }
57 #else
58 NOTIMPLEMENTED();
59 #endif
60 return false;
61 }
62
63 #if defined(OS_CHROMEOS)
64 void CapsLockHandler::OnCapsLockChange(bool enabled) {
65 caps_lock_is_on_ = enabled;
66 }
67 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698