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

Side by Side Diff: chrome/browser/ui/ash/caps_lock_handler.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 "chrome/browser/ui/ash/caps_lock_handler.h" 5 #include "chrome/browser/ui/ash/caps_lock_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 9
10 // TODO(yusukes): Support Ash on Windows. 10 // TODO(yusukes): Support Ash on Windows.
(...skipping 19 matching lines...) Expand all
30 30
31 CapsLockHandler::~CapsLockHandler() { 31 CapsLockHandler::~CapsLockHandler() {
32 #if defined(OS_CHROMEOS) 32 #if defined(OS_CHROMEOS)
33 chromeos::SystemKeyEventListener* system_event_listener = 33 chromeos::SystemKeyEventListener* system_event_listener =
34 chromeos::SystemKeyEventListener::GetInstance(); 34 chromeos::SystemKeyEventListener::GetInstance();
35 if (system_event_listener) 35 if (system_event_listener)
36 system_event_listener->RemoveCapsLockObserver(this); 36 system_event_listener->RemoveCapsLockObserver(this);
37 #endif 37 #endif
38 } 38 }
39 39
40 bool CapsLockHandler::HandleToggleCapsLock() { 40 bool CapsLockHandler::IsCapsLockEnabled() const {
41 #if defined(OS_CHROMEOS)
42 return caps_lock_is_on_;
43 #else
44 NOTIMPLEMENTED();
45 return false;
46 #endif
47 }
48
49 void CapsLockHandler::SetCapsLockEnabled(bool enabled) {
50 #if defined(OS_CHROMEOS)
51 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
52 if (is_running_on_chromeos_) {
53 xkeyboard_->SetCapsLockEnabled(enabled);
54 return;
55 }
56 #else
57 NOTIMPLEMENTED();
58 #endif
59 }
60
61 void CapsLockHandler::ToggleCapsLock() {
41 #if defined(OS_CHROMEOS) 62 #if defined(OS_CHROMEOS)
42 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 63 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
43 if (is_running_on_chromeos_) { 64 if (is_running_on_chromeos_) {
44 xkeyboard_->SetCapsLockEnabled(!caps_lock_is_on_); 65 xkeyboard_->SetCapsLockEnabled(!caps_lock_is_on_);
45 return true; // consume the shortcut key. 66 return;
46 } 67 }
47 #else 68 #else
48 NOTIMPLEMENTED(); 69 NOTIMPLEMENTED();
49 #endif 70 #endif
50 return false;
51 } 71 }
52 72
53 #if defined(OS_CHROMEOS) 73 #if defined(OS_CHROMEOS)
54 void CapsLockHandler::OnCapsLockChange(bool enabled) { 74 void CapsLockHandler::OnCapsLockChange(bool enabled) {
55 caps_lock_is_on_ = enabled; 75 caps_lock_is_on_ = enabled;
56 } 76 }
57 #endif 77 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/caps_lock_handler.h ('k') | chrome/browser/ui/ash/caps_lock_handler_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698