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 "chrome/browser/ui/ash/caps_lock_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/caps_lock_delegate_chromeos.h" |
6 | 6 |
7 #include "base/chromeos/chromeos_version.h" | |
8 #include "base/command_line.h" | 7 #include "base/command_line.h" |
9 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/sys_info.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "chromeos/ime/xkeyboard.h" | 11 #include "chromeos/ime/xkeyboard.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 | 13 |
14 CapsLockDelegate::CapsLockDelegate(chromeos::input_method::XKeyboard* xkeyboard) | 14 CapsLockDelegate::CapsLockDelegate(chromeos::input_method::XKeyboard* xkeyboard) |
15 : xkeyboard_(xkeyboard), | 15 : xkeyboard_(xkeyboard), |
16 is_running_on_chromeos_(base::chromeos::IsRunningOnChromeOS()), | 16 is_running_on_chromeos_(base::SysInfo::IsRunningOnChromeOS()), |
17 caps_lock_is_on_(xkeyboard_->CapsLockIsEnabled()) { | 17 caps_lock_is_on_(xkeyboard_->CapsLockIsEnabled()) { |
18 chromeos::SystemKeyEventListener* system_event_listener = | 18 chromeos::SystemKeyEventListener* system_event_listener = |
19 chromeos::SystemKeyEventListener::GetInstance(); | 19 chromeos::SystemKeyEventListener::GetInstance(); |
20 // SystemKeyEventListener should be instantiated when we're running production | 20 // SystemKeyEventListener should be instantiated when we're running production |
21 // code on Chrome OS. | 21 // code on Chrome OS. |
22 DCHECK(!is_running_on_chromeos_ || system_event_listener || | 22 DCHECK(!is_running_on_chromeos_ || system_event_listener || |
23 CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)); | 23 CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)); |
24 if (system_event_listener) | 24 if (system_event_listener) |
25 system_event_listener->AddCapsLockObserver(this); | 25 system_event_listener->AddCapsLockObserver(this); |
26 } | 26 } |
(...skipping 21 matching lines...) Expand all Loading... |
48 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 48 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
49 if (is_running_on_chromeos_) { | 49 if (is_running_on_chromeos_) { |
50 xkeyboard_->SetCapsLockEnabled(!caps_lock_is_on_); | 50 xkeyboard_->SetCapsLockEnabled(!caps_lock_is_on_); |
51 return; | 51 return; |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 void CapsLockDelegate::OnCapsLockChange(bool enabled) { | 55 void CapsLockDelegate::OnCapsLockChange(bool enabled) { |
56 caps_lock_is_on_ = enabled; | 56 caps_lock_is_on_ = enabled; |
57 } | 57 } |
OLD | NEW |