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/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/tray/hover_highlight_view.h" | 10 #include "ash/system/tray/hover_highlight_view.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 tray_icon_visible_ = visible; | 305 tray_icon_visible_ = visible; |
306 } | 306 } |
307 | 307 |
308 tray::AccessibilityDetailedView* TrayAccessibility::CreateDetailedMenu() { | 308 tray::AccessibilityDetailedView* TrayAccessibility::CreateDetailedMenu() { |
309 return new tray::AccessibilityDetailedView(this, login_); | 309 return new tray::AccessibilityDetailedView(this, login_); |
310 } | 310 } |
311 | 311 |
312 bool TrayAccessibility::GetInitialVisibility() { | 312 bool TrayAccessibility::GetInitialVisibility() { |
313 // Shows accessibility icon if any accessibility feature is enabled. | 313 // Shows accessibility icon if any accessibility feature is enabled. |
314 // Otherwise, doen't show it. | 314 // Otherwise, doen't show it. |
315 return GetAccessibilityState() != A11Y_NONE; | 315 return Shell::GetInstance()->accessibility_delegate()-> |
| 316 ShouldShowAccessibilityMenu(); |
316 } | 317 } |
317 | 318 |
318 views::View* TrayAccessibility::CreateDefaultView(user::LoginStatus status) { | 319 views::View* TrayAccessibility::CreateDefaultView(user::LoginStatus status) { |
319 CHECK(default_ == NULL); | 320 CHECK(default_ == NULL); |
320 | 321 |
321 // Shows accessibility menu if: | 322 // Shows accessibility menu if: |
322 // - on login screen (not logged in); | 323 // - on login screen (not logged in); |
323 // - "Enable accessibility menu" on chrome://settings is checked; | 324 // - "Enable accessibility menu" on chrome://settings is checked; |
324 // - or any of accessibility features is enabled | 325 // - or any of accessibility features is enabled |
325 // Otherwise, not shows it. | 326 // Otherwise, not shows it. |
326 AccessibilityDelegate* delegate = | 327 AccessibilityDelegate* delegate = |
327 Shell::GetInstance()->accessibility_delegate(); | 328 Shell::GetInstance()->accessibility_delegate(); |
328 if (login_ != user::LOGGED_IN_NONE && | 329 if (login_ != user::LOGGED_IN_NONE && |
329 !delegate->ShouldAlwaysShowAccessibilityMenu() && | 330 !delegate->ShouldShowAccessibilityMenu() && |
330 // On login screen, keeps the initial visivility of the menu. | 331 // On login screen, keeps the initial visibility of the menu. |
331 (status != user::LOGGED_IN_LOCKED || !show_a11y_menu_on_lock_screen_) && | 332 (status != user::LOGGED_IN_LOCKED || !show_a11y_menu_on_lock_screen_)) |
332 GetAccessibilityState() == A11Y_NONE) | |
333 return NULL; | 333 return NULL; |
334 | 334 |
335 CHECK(default_ == NULL); | 335 CHECK(default_ == NULL); |
336 default_ = new tray::DefaultAccessibilityView(this); | 336 default_ = new tray::DefaultAccessibilityView(this); |
337 | 337 |
338 return default_; | 338 return default_; |
339 } | 339 } |
340 | 340 |
341 views::View* TrayAccessibility::CreateDetailedView(user::LoginStatus status) { | 341 views::View* TrayAccessibility::CreateDetailedView(user::LoginStatus status) { |
342 CHECK(detailed_popup_ == NULL); | 342 CHECK(detailed_popup_ == NULL); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 detailed_popup_->GetWidget()->Close(); | 388 detailed_popup_->GetWidget()->Close(); |
389 if (detailed_menu_) | 389 if (detailed_menu_) |
390 detailed_menu_->GetWidget()->Close(); | 390 detailed_menu_->GetWidget()->Close(); |
391 } | 391 } |
392 | 392 |
393 previous_accessibility_state_ = accessibility_state; | 393 previous_accessibility_state_ = accessibility_state; |
394 } | 394 } |
395 | 395 |
396 } // namespace internal | 396 } // namespace internal |
397 } // namespace ash | 397 } // namespace ash |
OLD | NEW |