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/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
8 #include "ash/metrics/user_metrics_recorder.h" | 8 #include "ash/metrics/user_metrics_recorder.h" |
9 #include "ash/session/session_state_delegate.h" | 9 #include "ash/session/session_state_delegate.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 void AccessibilityDetailedView::OnViewClicked(views::View* sender) { | 257 void AccessibilityDetailedView::OnViewClicked(views::View* sender) { |
258 AccessibilityDelegate* delegate = | 258 AccessibilityDelegate* delegate = |
259 Shell::GetInstance()->accessibility_delegate(); | 259 Shell::GetInstance()->accessibility_delegate(); |
260 if (sender == footer()->content()) { | 260 if (sender == footer()->content()) { |
261 TransitionToDefaultView(); | 261 TransitionToDefaultView(); |
262 } else if (sender == spoken_feedback_view_) { | 262 } else if (sender == spoken_feedback_view_) { |
263 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 263 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
264 delegate->IsSpokenFeedbackEnabled() ? | 264 delegate->IsSpokenFeedbackEnabled() ? |
265 ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK : | 265 ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK : |
266 ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK); | 266 ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK); |
267 delegate->ToggleSpokenFeedback(ash::A11Y_NOTIFICATION_NONE); | 267 delegate->ToggleSpokenFeedback(ui::A11Y_NOTIFICATION_NONE); |
268 } else if (sender == high_contrast_view_) { | 268 } else if (sender == high_contrast_view_) { |
269 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 269 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
270 delegate->IsHighContrastEnabled() ? | 270 delegate->IsHighContrastEnabled() ? |
271 ash::UMA_STATUS_AREA_DISABLE_HIGH_CONTRAST : | 271 ash::UMA_STATUS_AREA_DISABLE_HIGH_CONTRAST : |
272 ash::UMA_STATUS_AREA_ENABLE_HIGH_CONTRAST); | 272 ash::UMA_STATUS_AREA_ENABLE_HIGH_CONTRAST); |
273 delegate->ToggleHighContrast(); | 273 delegate->ToggleHighContrast(); |
274 } else if (sender == screen_magnifier_view_) { | 274 } else if (sender == screen_magnifier_view_) { |
275 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 275 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
276 delegate->IsMagnifierEnabled() ? | 276 delegate->IsMagnifierEnabled() ? |
277 ash::UMA_STATUS_AREA_DISABLE_MAGNIFIER : | 277 ash::UMA_STATUS_AREA_DISABLE_MAGNIFIER : |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 void TrayAccessibility::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 400 void TrayAccessibility::UpdateAfterLoginStatusChange(user::LoginStatus status) { |
401 // Stores the a11y feature status on just entering the lock screen. | 401 // Stores the a11y feature status on just entering the lock screen. |
402 if (login_ != user::LOGGED_IN_LOCKED && status == user::LOGGED_IN_LOCKED) | 402 if (login_ != user::LOGGED_IN_LOCKED && status == user::LOGGED_IN_LOCKED) |
403 show_a11y_menu_on_lock_screen_ = (GetAccessibilityState() != A11Y_NONE); | 403 show_a11y_menu_on_lock_screen_ = (GetAccessibilityState() != A11Y_NONE); |
404 | 404 |
405 login_ = status; | 405 login_ = status; |
406 SetTrayIconVisible(GetInitialVisibility()); | 406 SetTrayIconVisible(GetInitialVisibility()); |
407 } | 407 } |
408 | 408 |
409 void TrayAccessibility::OnAccessibilityModeChanged( | 409 void TrayAccessibility::OnAccessibilityModeChanged( |
410 AccessibilityNotificationVisibility notify) { | 410 ui::AccessibilityNotificationVisibility notify) { |
411 SetTrayIconVisible(GetInitialVisibility()); | 411 SetTrayIconVisible(GetInitialVisibility()); |
412 | 412 |
413 uint32 accessibility_state = GetAccessibilityState(); | 413 uint32 accessibility_state = GetAccessibilityState(); |
414 // We'll get an extra notification if a braille display is connected when | 414 // We'll get an extra notification if a braille display is connected when |
415 // spoken feedback wasn't already enabled. This is because the braille | 415 // spoken feedback wasn't already enabled. This is because the braille |
416 // connection state is already updated when spoken feedback is enabled so | 416 // connection state is already updated when spoken feedback is enabled so |
417 // that the notifications can be consolidated into one. Therefore, we | 417 // that the notifications can be consolidated into one. Therefore, we |
418 // return early if there's no change in the state that we keep track of. | 418 // return early if there's no change in the state that we keep track of. |
419 if (accessibility_state == previous_accessibility_state_) | 419 if (accessibility_state == previous_accessibility_state_) |
420 return; | 420 return; |
421 // Contains bits for spoken feedback and braille display connected currently | 421 // Contains bits for spoken feedback and braille display connected currently |
422 // being enabled. | 422 // being enabled. |
423 uint32 being_enabled = | 423 uint32 being_enabled = |
424 (accessibility_state & ~previous_accessibility_state_) & | 424 (accessibility_state & ~previous_accessibility_state_) & |
425 (A11Y_SPOKEN_FEEDBACK | A11Y_BRAILLE_DISPLAY_CONNECTED); | 425 (A11Y_SPOKEN_FEEDBACK | A11Y_BRAILLE_DISPLAY_CONNECTED); |
426 if ((notify == ash::A11Y_NOTIFICATION_SHOW) && being_enabled != A11Y_NONE) { | 426 if ((notify == ui::A11Y_NOTIFICATION_SHOW) && being_enabled != A11Y_NONE) { |
427 // Shows popup if |notify| is true and the spoken feedback is being enabled. | 427 // Shows popup if |notify| is true and the spoken feedback is being enabled. |
428 request_popup_view_state_ = being_enabled; | 428 request_popup_view_state_ = being_enabled; |
429 PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false); | 429 PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false); |
430 } else { | 430 } else { |
431 if (detailed_popup_) | 431 if (detailed_popup_) |
432 detailed_popup_->GetWidget()->Close(); | 432 detailed_popup_->GetWidget()->Close(); |
433 if (detailed_menu_) | 433 if (detailed_menu_) |
434 detailed_menu_->GetWidget()->Close(); | 434 detailed_menu_->GetWidget()->Close(); |
435 } | 435 } |
436 | 436 |
437 previous_accessibility_state_ = accessibility_state; | 437 previous_accessibility_state_ = accessibility_state; |
438 } | 438 } |
439 | 439 |
440 } // namespace ash | 440 } // namespace ash |
OLD | NEW |