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/system/tray_accessibility.h" | 5 #include "ash/system/tray_accessibility.h" |
6 | 6 |
7 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
| 8 #include "ash/common/accessibility_types.h" |
8 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
9 #include "ash/common/system/tray/hover_highlight_view.h" | 10 #include "ash/common/system/tray/hover_highlight_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_item_more.h" | 13 #include "ash/common/system/tray/tray_item_more.h" |
13 #include "ash/common/system/tray/tray_popup_label_button.h" | 14 #include "ash/common/system/tray/tray_popup_label_button.h" |
14 #include "ash/common/system/tray/wm_system_tray_notifier.h" | 15 #include "ash/common/system/tray/wm_system_tray_notifier.h" |
15 #include "ash/common/wm_shell.h" | 16 #include "ash/common/wm_shell.h" |
16 #include "ash/system/tray/system_tray.h" | 17 #include "ash/system/tray/system_tray.h" |
17 #include "ash/system/tray/tray_details_view.h" | 18 #include "ash/system/tray/tray_details_view.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 242 |
242 void AccessibilityDetailedView::OnViewClicked(views::View* sender) { | 243 void AccessibilityDetailedView::OnViewClicked(views::View* sender) { |
243 AccessibilityDelegate* delegate = WmShell::Get()->GetAccessibilityDelegate(); | 244 AccessibilityDelegate* delegate = WmShell::Get()->GetAccessibilityDelegate(); |
244 if (sender == footer()->content()) { | 245 if (sender == footer()->content()) { |
245 TransitionToDefaultView(); | 246 TransitionToDefaultView(); |
246 } else if (sender == spoken_feedback_view_) { | 247 } else if (sender == spoken_feedback_view_) { |
247 WmShell::Get()->RecordUserMetricsAction( | 248 WmShell::Get()->RecordUserMetricsAction( |
248 delegate->IsSpokenFeedbackEnabled() ? | 249 delegate->IsSpokenFeedbackEnabled() ? |
249 ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK : | 250 ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK : |
250 ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK); | 251 ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK); |
251 delegate->ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_NONE); | 252 delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); |
252 } else if (sender == high_contrast_view_) { | 253 } else if (sender == high_contrast_view_) { |
253 WmShell::Get()->RecordUserMetricsAction( | 254 WmShell::Get()->RecordUserMetricsAction( |
254 delegate->IsHighContrastEnabled() ? | 255 delegate->IsHighContrastEnabled() ? |
255 ash::UMA_STATUS_AREA_DISABLE_HIGH_CONTRAST : | 256 ash::UMA_STATUS_AREA_DISABLE_HIGH_CONTRAST : |
256 ash::UMA_STATUS_AREA_ENABLE_HIGH_CONTRAST); | 257 ash::UMA_STATUS_AREA_ENABLE_HIGH_CONTRAST); |
257 delegate->ToggleHighContrast(); | 258 delegate->ToggleHighContrast(); |
258 } else if (sender == screen_magnifier_view_) { | 259 } else if (sender == screen_magnifier_view_) { |
259 WmShell::Get()->RecordUserMetricsAction( | 260 WmShell::Get()->RecordUserMetricsAction( |
260 delegate->IsMagnifierEnabled() ? | 261 delegate->IsMagnifierEnabled() ? |
261 ash::UMA_STATUS_AREA_DISABLE_MAGNIFIER : | 262 ash::UMA_STATUS_AREA_DISABLE_MAGNIFIER : |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 void TrayAccessibility::UpdateAfterLoginStatusChange(LoginStatus status) { | 381 void TrayAccessibility::UpdateAfterLoginStatusChange(LoginStatus status) { |
381 // Stores the a11y feature status on just entering the lock screen. | 382 // Stores the a11y feature status on just entering the lock screen. |
382 if (login_ != LoginStatus::LOCKED && status == LoginStatus::LOCKED) | 383 if (login_ != LoginStatus::LOCKED && status == LoginStatus::LOCKED) |
383 show_a11y_menu_on_lock_screen_ = (GetAccessibilityState() != A11Y_NONE); | 384 show_a11y_menu_on_lock_screen_ = (GetAccessibilityState() != A11Y_NONE); |
384 | 385 |
385 login_ = status; | 386 login_ = status; |
386 SetTrayIconVisible(GetInitialVisibility()); | 387 SetTrayIconVisible(GetInitialVisibility()); |
387 } | 388 } |
388 | 389 |
389 void TrayAccessibility::OnAccessibilityModeChanged( | 390 void TrayAccessibility::OnAccessibilityModeChanged( |
390 ui::AccessibilityNotificationVisibility notify) { | 391 AccessibilityNotificationVisibility notify) { |
391 SetTrayIconVisible(GetInitialVisibility()); | 392 SetTrayIconVisible(GetInitialVisibility()); |
392 | 393 |
393 uint32_t accessibility_state = GetAccessibilityState(); | 394 uint32_t accessibility_state = GetAccessibilityState(); |
394 // We'll get an extra notification if a braille display is connected when | 395 // We'll get an extra notification if a braille display is connected when |
395 // spoken feedback wasn't already enabled. This is because the braille | 396 // spoken feedback wasn't already enabled. This is because the braille |
396 // connection state is already updated when spoken feedback is enabled so | 397 // connection state is already updated when spoken feedback is enabled so |
397 // that the notifications can be consolidated into one. Therefore, we | 398 // that the notifications can be consolidated into one. Therefore, we |
398 // return early if there's no change in the state that we keep track of. | 399 // return early if there's no change in the state that we keep track of. |
399 if (accessibility_state == previous_accessibility_state_) | 400 if (accessibility_state == previous_accessibility_state_) |
400 return; | 401 return; |
401 // Contains bits for spoken feedback and braille display connected currently | 402 // Contains bits for spoken feedback and braille display connected currently |
402 // being enabled. | 403 // being enabled. |
403 uint32_t being_enabled = | 404 uint32_t being_enabled = |
404 (accessibility_state & ~previous_accessibility_state_) & | 405 (accessibility_state & ~previous_accessibility_state_) & |
405 (A11Y_SPOKEN_FEEDBACK | A11Y_BRAILLE_DISPLAY_CONNECTED); | 406 (A11Y_SPOKEN_FEEDBACK | A11Y_BRAILLE_DISPLAY_CONNECTED); |
406 if ((notify == ui::A11Y_NOTIFICATION_SHOW) && being_enabled != A11Y_NONE) { | 407 if ((notify == A11Y_NOTIFICATION_SHOW) && being_enabled != A11Y_NONE) { |
407 // Shows popup if |notify| is true and the spoken feedback is being enabled. | 408 // Shows popup if |notify| is true and the spoken feedback is being enabled. |
408 request_popup_view_state_ = being_enabled; | 409 request_popup_view_state_ = being_enabled; |
409 PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false); | 410 PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false); |
410 } else { | 411 } else { |
411 if (detailed_popup_) | 412 if (detailed_popup_) |
412 detailed_popup_->GetWidget()->Close(); | 413 detailed_popup_->GetWidget()->Close(); |
413 if (detailed_menu_) | 414 if (detailed_menu_) |
414 detailed_menu_->GetWidget()->Close(); | 415 detailed_menu_->GetWidget()->Close(); |
415 } | 416 } |
416 | 417 |
417 previous_accessibility_state_ = accessibility_state; | 418 previous_accessibility_state_ = accessibility_state; |
418 } | 419 } |
419 | 420 |
420 } // namespace ash | 421 } // namespace ash |
OLD | NEW |