Chromium Code Reviews| 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/fixed_sized_image_view.h" | 10 #include "ash/common/system/tray/fixed_sized_image_view.h" |
| 10 #include "ash/common/system/tray/system_tray_delegate.h" | 11 #include "ash/common/system/tray/system_tray_delegate.h" |
| 11 #include "ash/common/system/tray/tray_constants.h" | 12 #include "ash/common/system/tray/tray_constants.h" |
| 12 #include "ash/common/system/tray/tray_popup_utils.h" | 13 #include "ash/common/system/tray/tray_popup_utils.h" |
| 13 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 14 #include "ash/resources/vector_icons/vector_icons.h" | 15 #include "ash/resources/vector_icons/vector_icons.h" |
| 15 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
| 16 #include "grit/ash_resources.h" | 17 #include "grit/ash_resources.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 TrayCapsLock::~TrayCapsLock() { | 155 TrayCapsLock::~TrayCapsLock() { |
| 155 chromeos::input_method::InputMethodManager* ime = | 156 chromeos::input_method::InputMethodManager* ime = |
| 156 chromeos::input_method::InputMethodManager::Get(); | 157 chromeos::input_method::InputMethodManager::Get(); |
| 157 if (ime && ime->GetImeKeyboard()) | 158 if (ime && ime->GetImeKeyboard()) |
| 158 ime->GetImeKeyboard()->RemoveObserver(this); | 159 ime->GetImeKeyboard()->RemoveObserver(this); |
| 159 } | 160 } |
| 160 | 161 |
| 161 void TrayCapsLock::OnCapsLockChanged(bool enabled) { | 162 void TrayCapsLock::OnCapsLockChanged(bool enabled) { |
| 162 caps_lock_enabled_ = enabled; | 163 caps_lock_enabled_ = enabled; |
| 163 | 164 |
| 165 // Send an a11y alert. | |
| 166 if (enabled) { | |
| 167 WmShell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( | |
| 168 A11Y_ALERT_CAPS_ON); | |
| 169 } else { | |
| 170 WmShell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( | |
| 171 A11Y_ALERT_CAPS_OFF); | |
|
oshima
2016/11/10 22:41:40
nit:
WmShell::Get()->acces..->TriggerAccessibilit
David Tseng
2016/11/10 23:46:04
Done.
| |
| 172 } | |
| 173 | |
| 164 if (tray_view()) | 174 if (tray_view()) |
| 165 tray_view()->SetVisible(caps_lock_enabled_); | 175 tray_view()->SetVisible(caps_lock_enabled_); |
| 166 | 176 |
| 167 if (default_) { | 177 if (default_) { |
| 168 default_->Update(caps_lock_enabled_); | 178 default_->Update(caps_lock_enabled_); |
| 169 } else { | 179 } else { |
| 170 if (caps_lock_enabled_) { | 180 if (caps_lock_enabled_) { |
| 171 if (!message_shown_) { | 181 if (!message_shown_) { |
| 172 WmShell::Get()->RecordUserMetricsAction( | 182 WmShell::Get()->RecordUserMetricsAction( |
| 173 UMA_STATUS_AREA_CAPS_LOCK_POPUP); | 183 UMA_STATUS_AREA_CAPS_LOCK_POPUP); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 | 239 |
| 230 void TrayCapsLock::DestroyDefaultView() { | 240 void TrayCapsLock::DestroyDefaultView() { |
| 231 default_ = NULL; | 241 default_ = NULL; |
| 232 } | 242 } |
| 233 | 243 |
| 234 void TrayCapsLock::DestroyDetailedView() { | 244 void TrayCapsLock::DestroyDetailedView() { |
| 235 detailed_ = NULL; | 245 detailed_ = NULL; |
| 236 } | 246 } |
| 237 | 247 |
| 238 } // namespace ash | 248 } // namespace ash |
| OLD | NEW |