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/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/system/tray/hover_highlight_view.h" | 9 #include "ash/system/tray/hover_highlight_view.h" |
10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 tray_icon_visible_ = visible; | 284 tray_icon_visible_ = visible; |
285 } | 285 } |
286 | 286 |
287 tray::AccessibilityDetailedView* TrayAccessibility::CreateDetailedMenu() { | 287 tray::AccessibilityDetailedView* TrayAccessibility::CreateDetailedMenu() { |
288 return new tray::AccessibilityDetailedView(this, login_); | 288 return new tray::AccessibilityDetailedView(this, login_); |
289 } | 289 } |
290 | 290 |
291 bool TrayAccessibility::GetInitialVisibility() { | 291 bool TrayAccessibility::GetInitialVisibility() { |
292 // Shows accessibility icon if any accessibility feature is enabled. | 292 // Shows accessibility icon if any accessibility feature is enabled. |
293 // Otherwise, doen't show it. | 293 // Otherwise, doen't show it. |
294 return GetAccessibilityState() != A11Y_NONE; | 294 return Shell::GetInstance()->accessibility_delegate()-> |
| 295 ShouldShowAccessibilityMenu(); |
295 } | 296 } |
296 | 297 |
297 views::View* TrayAccessibility::CreateDefaultView(user::LoginStatus status) { | 298 views::View* TrayAccessibility::CreateDefaultView(user::LoginStatus status) { |
298 CHECK(default_ == NULL); | 299 CHECK(default_ == NULL); |
299 | 300 |
300 // Shows accessibility menu if: | 301 // Shows accessibility menu if: |
301 // - on login screen (not logged in); | 302 // - on login screen (not logged in); |
302 // - "Enable accessibility menu" on chrome://settings is checked; | 303 // - "Enable accessibility menu" on chrome://settings is checked; |
303 // - or any of accessibility features is enabled | 304 // - or any of accessibility features is enabled |
304 // Otherwise, not shows it. | 305 // Otherwise, not shows it. |
305 AccessibilityDelegate* delegate = | 306 AccessibilityDelegate* delegate = |
306 Shell::GetInstance()->accessibility_delegate(); | 307 Shell::GetInstance()->accessibility_delegate(); |
307 if (login_ != user::LOGGED_IN_NONE && | 308 if (login_ != user::LOGGED_IN_NONE && |
308 !delegate->ShouldAlwaysShowAccessibilityMenu() && | 309 !delegate->ShouldShowAccessibilityMenu() && |
309 // On login screen, keeps the initial visivility of the menu. | 310 // On login screen, keeps the initial visibility of the menu. |
310 (status != user::LOGGED_IN_LOCKED || !show_a11y_menu_on_lock_screen_) && | 311 (status != user::LOGGED_IN_LOCKED || !show_a11y_menu_on_lock_screen_)) |
311 GetAccessibilityState() == A11Y_NONE) | |
312 return NULL; | 312 return NULL; |
313 | 313 |
314 CHECK(default_ == NULL); | 314 CHECK(default_ == NULL); |
315 default_ = new tray::DefaultAccessibilityView(this); | 315 default_ = new tray::DefaultAccessibilityView(this); |
316 | 316 |
317 return default_; | 317 return default_; |
318 } | 318 } |
319 | 319 |
320 views::View* TrayAccessibility::CreateDetailedView(user::LoginStatus status) { | 320 views::View* TrayAccessibility::CreateDetailedView(user::LoginStatus status) { |
321 CHECK(detailed_popup_ == NULL); | 321 CHECK(detailed_popup_ == NULL); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 detailed_popup_->GetWidget()->Close(); | 365 detailed_popup_->GetWidget()->Close(); |
366 if (detailed_menu_) | 366 if (detailed_menu_) |
367 detailed_menu_->GetWidget()->Close(); | 367 detailed_menu_->GetWidget()->Close(); |
368 } | 368 } |
369 | 369 |
370 previous_accessibility_state_ = accessibility_state; | 370 previous_accessibility_state_ = accessibility_state; |
371 } | 371 } |
372 | 372 |
373 } // namespace internal | 373 } // namespace internal |
374 } // namespace ash | 374 } // namespace ash |
OLD | NEW |