Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: ash/system/tray_accessibility.cc

Issue 11280236: A11y: Add the option to always show the a11y tray menu regardless of the state of a11y features (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/tray_accessibility.h ('k') | ash/test/test_shell_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_delegate.h" 8 #include "ash/shell_delegate.h"
9 #include "ash/system/tray/system_tray.h" 9 #include "ash/system/tray/system_tray.h"
10 #include "ash/system/tray/system_tray_delegate.h" 10 #include "ash/system/tray/system_tray_delegate.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 TrayAccessibility::TrayAccessibility(SystemTray* system_tray) 221 TrayAccessibility::TrayAccessibility(SystemTray* system_tray)
222 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_ACCESSIBILITY), 222 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_ACCESSIBILITY),
223 default_(NULL), 223 default_(NULL),
224 detailed_(NULL), 224 detailed_(NULL),
225 request_popup_view_(false), 225 request_popup_view_(false),
226 accessibility_previously_enabled_(IsAnyAccessibilityFeatureEnabled()), 226 accessibility_previously_enabled_(IsAnyAccessibilityFeatureEnabled()),
227 login_(GetCurrentLoginStatus()) { 227 login_(GetCurrentLoginStatus()) {
228 DCHECK(Shell::GetInstance()->delegate()); 228 DCHECK(Shell::GetInstance()->delegate());
229 DCHECK(system_tray); 229 DCHECK(system_tray);
230
231 Shell::GetInstance()->AddShellObserver(this);
232 } 230 }
233 231
234 TrayAccessibility::~TrayAccessibility() { 232 TrayAccessibility::~TrayAccessibility() {
235 Shell::GetInstance()->RemoveShellObserver(this);
236 } 233 }
237 234
238 bool TrayAccessibility::GetInitialVisibility() { 235 bool TrayAccessibility::GetInitialVisibility() {
239 ShellDelegate* delegate = Shell::GetInstance()->delegate(); 236 ShellDelegate* delegate = Shell::GetInstance()->delegate();
240 // Always shows this on the login screen. 237 // Always shows this on the login screen.
241 if (login_ == user::LOGGED_IN_NONE) 238 if (login_ == user::LOGGED_IN_NONE)
242 return true; 239 return true;
243 240
244 if (delegate->ShouldAlwaysShowAccessibilityMenu() || 241 if (delegate->ShouldAlwaysShowAccessibilityMenu() ||
245 IsAnyAccessibilityFeatureEnabled()) { 242 IsAnyAccessibilityFeatureEnabled()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 276 }
280 277
281 void TrayAccessibility::DestroyDefaultView() { 278 void TrayAccessibility::DestroyDefaultView() {
282 default_ = NULL; 279 default_ = NULL;
283 } 280 }
284 281
285 void TrayAccessibility::DestroyDetailedView() { 282 void TrayAccessibility::DestroyDetailedView() {
286 detailed_ = NULL; 283 detailed_ = NULL;
287 } 284 }
288 285
289 void TrayAccessibility::OnLoginStateChanged(user::LoginStatus status) { 286 void TrayAccessibility::UpdateAfterLoginStatusChange(user::LoginStatus status) {
290 login_ = status; 287 login_ = status;
291 288
292 if (tray_view()) 289 if (tray_view())
293 tray_view()->SetVisible(GetInitialVisibility()); 290 tray_view()->SetVisible(GetInitialVisibility());
294 } 291 }
295 292
296 void TrayAccessibility::OnAccessibilityModeChanged() { 293 void TrayAccessibility::OnAccessibilityModeChanged() {
297 if (tray_view()) 294 if (tray_view())
298 tray_view()->SetVisible(GetInitialVisibility()); 295 tray_view()->SetVisible(GetInitialVisibility());
299 296
300 bool accessibility_enabled = IsAnyAccessibilityFeatureEnabled(); 297 bool accessibility_enabled = IsAnyAccessibilityFeatureEnabled();
301 if (!accessibility_previously_enabled_ && accessibility_enabled && 298 if (!accessibility_previously_enabled_ && accessibility_enabled &&
302 login_ != user::LOGGED_IN_NONE) { 299 login_ != user::LOGGED_IN_NONE) {
303 // Shows popup if the accessibilty status is being changed to true from 300 // Shows popup if the accessibilty status is being changed to true from
304 // false. 301 // false.
305 request_popup_view_ = true; 302 request_popup_view_ = true;
306 PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false); 303 PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false);
307 } else if (detailed_) { 304 } else if (detailed_) {
308 detailed_->GetWidget()->Close(); 305 detailed_->GetWidget()->Close();
309 } 306 }
310 307
311 accessibility_previously_enabled_ = accessibility_enabled; 308 accessibility_previously_enabled_ = accessibility_enabled;
312 } 309 }
313 310
314 } // namespace internal 311 } // namespace internal
315 } // namespace ash 312 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray_accessibility.h ('k') | ash/test/test_shell_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698