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