| 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 "ash/common/system/chromeos/tray_caps_lock.h" | 5 #include "ash/common/system/chromeos/tray_caps_lock.h" |
| 6 | 6 |
| 7 #include "ash/common/accessibility_delegate.h" |
| 7 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/system/tray/actionable_view.h" | 9 #include "ash/common/system/tray/actionable_view.h" |
| 9 #include "ash/common/system/tray/system_tray_delegate.h" | 10 #include "ash/common/system/tray/system_tray_delegate.h" |
| 10 #include "ash/common/system/tray/tray_constants.h" | 11 #include "ash/common/system/tray/tray_constants.h" |
| 11 #include "ash/common/system/tray/tray_popup_utils.h" | 12 #include "ash/common/system/tray/tray_popup_utils.h" |
| 12 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 13 #include "ash/resources/vector_icons/vector_icons.h" | 14 #include "ash/resources/vector_icons/vector_icons.h" |
| 14 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
| 15 #include "grit/ash_resources.h" | 16 #include "grit/ash_resources.h" |
| 16 #include "grit/ash_strings.h" | 17 #include "grit/ash_strings.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 TrayCapsLock::~TrayCapsLock() { | 153 TrayCapsLock::~TrayCapsLock() { |
| 153 chromeos::input_method::InputMethodManager* ime = | 154 chromeos::input_method::InputMethodManager* ime = |
| 154 chromeos::input_method::InputMethodManager::Get(); | 155 chromeos::input_method::InputMethodManager::Get(); |
| 155 if (ime && ime->GetImeKeyboard()) | 156 if (ime && ime->GetImeKeyboard()) |
| 156 ime->GetImeKeyboard()->RemoveObserver(this); | 157 ime->GetImeKeyboard()->RemoveObserver(this); |
| 157 } | 158 } |
| 158 | 159 |
| 159 void TrayCapsLock::OnCapsLockChanged(bool enabled) { | 160 void TrayCapsLock::OnCapsLockChanged(bool enabled) { |
| 160 caps_lock_enabled_ = enabled; | 161 caps_lock_enabled_ = enabled; |
| 161 | 162 |
| 163 // Send an a11y alert. |
| 164 WmShell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( |
| 165 enabled ? A11Y_ALERT_CAPS_ON : A11Y_ALERT_CAPS_OFF); |
| 166 |
| 162 if (tray_view()) | 167 if (tray_view()) |
| 163 tray_view()->SetVisible(caps_lock_enabled_); | 168 tray_view()->SetVisible(caps_lock_enabled_); |
| 164 | 169 |
| 165 if (default_) { | 170 if (default_) { |
| 166 default_->Update(caps_lock_enabled_); | 171 default_->Update(caps_lock_enabled_); |
| 167 } else { | 172 } else { |
| 168 if (caps_lock_enabled_) { | 173 if (caps_lock_enabled_) { |
| 169 if (!message_shown_) { | 174 if (!message_shown_) { |
| 170 WmShell::Get()->RecordUserMetricsAction( | 175 WmShell::Get()->RecordUserMetricsAction( |
| 171 UMA_STATUS_AREA_CAPS_LOCK_POPUP); | 176 UMA_STATUS_AREA_CAPS_LOCK_POPUP); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 232 |
| 228 void TrayCapsLock::DestroyDefaultView() { | 233 void TrayCapsLock::DestroyDefaultView() { |
| 229 default_ = NULL; | 234 default_ = NULL; |
| 230 } | 235 } |
| 231 | 236 |
| 232 void TrayCapsLock::DestroyDetailedView() { | 237 void TrayCapsLock::DestroyDetailedView() { |
| 233 detailed_ = NULL; | 238 detailed_ = NULL; |
| 234 } | 239 } |
| 235 | 240 |
| 236 } // namespace ash | 241 } // namespace ash |
| OLD | NEW |