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

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

Issue 2154523002: Move AccessibilityDelegate ownership to ash::WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setmediadelegate
Patch Set: fix mash_unittests Created 4 years, 5 months 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
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/common/system/tray_accessibility.h" 5 #include "ash/common/system/tray_accessibility.h"
6 6
7 #include "ash/common/accessibility_delegate.h" 7 #include "ash/common/accessibility_delegate.h"
8 #include "ash/common/accessibility_types.h" 8 #include "ash/common/accessibility_types.h"
9 #include "ash/common/material_design/material_design_controller.h" 9 #include "ash/common/material_design/material_design_controller.h"
10 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
(...skipping 27 matching lines...) Expand all
38 A11Y_SPOKEN_FEEDBACK = 1 << 0, 38 A11Y_SPOKEN_FEEDBACK = 1 << 0,
39 A11Y_HIGH_CONTRAST = 1 << 1, 39 A11Y_HIGH_CONTRAST = 1 << 1,
40 A11Y_SCREEN_MAGNIFIER = 1 << 2, 40 A11Y_SCREEN_MAGNIFIER = 1 << 2,
41 A11Y_LARGE_CURSOR = 1 << 3, 41 A11Y_LARGE_CURSOR = 1 << 3,
42 A11Y_AUTOCLICK = 1 << 4, 42 A11Y_AUTOCLICK = 1 << 4,
43 A11Y_VIRTUAL_KEYBOARD = 1 << 5, 43 A11Y_VIRTUAL_KEYBOARD = 1 << 5,
44 A11Y_BRAILLE_DISPLAY_CONNECTED = 1 << 6, 44 A11Y_BRAILLE_DISPLAY_CONNECTED = 1 << 6,
45 }; 45 };
46 46
47 uint32_t GetAccessibilityState() { 47 uint32_t GetAccessibilityState() {
48 AccessibilityDelegate* delegate = WmShell::Get()->GetAccessibilityDelegate(); 48 AccessibilityDelegate* delegate = WmShell::Get()->accessibility_delegate();
49 uint32_t state = A11Y_NONE; 49 uint32_t state = A11Y_NONE;
50 if (delegate->IsSpokenFeedbackEnabled()) 50 if (delegate->IsSpokenFeedbackEnabled())
51 state |= A11Y_SPOKEN_FEEDBACK; 51 state |= A11Y_SPOKEN_FEEDBACK;
52 if (delegate->IsHighContrastEnabled()) 52 if (delegate->IsHighContrastEnabled())
53 state |= A11Y_HIGH_CONTRAST; 53 state |= A11Y_HIGH_CONTRAST;
54 if (delegate->IsMagnifierEnabled()) 54 if (delegate->IsMagnifierEnabled())
55 state |= A11Y_SCREEN_MAGNIFIER; 55 state |= A11Y_SCREEN_MAGNIFIER;
56 if (delegate->IsLargeCursorEnabled()) 56 if (delegate->IsLargeCursorEnabled())
57 state |= A11Y_LARGE_CURSOR; 57 state |= A11Y_LARGE_CURSOR;
58 if (delegate->IsAutoclickEnabled()) 58 if (delegate->IsAutoclickEnabled())
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 AppendHelpEntries(); 156 AppendHelpEntries();
157 CreateSpecialRow(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_TITLE, this); 157 CreateSpecialRow(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_TITLE, this);
158 158
159 Layout(); 159 Layout();
160 } 160 }
161 161
162 void AccessibilityDetailedView::AppendAccessibilityList() { 162 void AccessibilityDetailedView::AppendAccessibilityList() {
163 CreateScrollableList(); 163 CreateScrollableList();
164 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 164 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
165 165
166 AccessibilityDelegate* delegate = WmShell::Get()->GetAccessibilityDelegate(); 166 AccessibilityDelegate* delegate = WmShell::Get()->accessibility_delegate();
167 spoken_feedback_enabled_ = delegate->IsSpokenFeedbackEnabled(); 167 spoken_feedback_enabled_ = delegate->IsSpokenFeedbackEnabled();
168 spoken_feedback_view_ = 168 spoken_feedback_view_ =
169 AddScrollListItem(bundle.GetLocalizedString( 169 AddScrollListItem(bundle.GetLocalizedString(
170 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SPOKEN_FEEDBACK), 170 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SPOKEN_FEEDBACK),
171 spoken_feedback_enabled_, spoken_feedback_enabled_); 171 spoken_feedback_enabled_, spoken_feedback_enabled_);
172 172
173 // Large Cursor item is shown only in Login screen. 173 // Large Cursor item is shown only in Login screen.
174 if (login_ == LoginStatus::NOT_LOGGED_IN) { 174 if (login_ == LoginStatus::NOT_LOGGED_IN) {
175 large_cursor_enabled_ = delegate->IsLargeCursorEnabled(); 175 large_cursor_enabled_ = delegate->IsLargeCursorEnabled();
176 large_cursor_view_ = 176 large_cursor_view_ =
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const base::string16& text, 240 const base::string16& text,
241 bool highlight, 241 bool highlight,
242 bool checked) { 242 bool checked) {
243 HoverHighlightView* container = new HoverHighlightView(this); 243 HoverHighlightView* container = new HoverHighlightView(this);
244 container->AddCheckableLabel(text, highlight, checked); 244 container->AddCheckableLabel(text, highlight, checked);
245 scroll_content()->AddChildView(container); 245 scroll_content()->AddChildView(container);
246 return container; 246 return container;
247 } 247 }
248 248
249 void AccessibilityDetailedView::OnViewClicked(views::View* sender) { 249 void AccessibilityDetailedView::OnViewClicked(views::View* sender) {
250 AccessibilityDelegate* delegate = WmShell::Get()->GetAccessibilityDelegate(); 250 AccessibilityDelegate* delegate = WmShell::Get()->accessibility_delegate();
251 if (sender == footer()->content()) { 251 if (sender == footer()->content()) {
252 TransitionToDefaultView(); 252 TransitionToDefaultView();
253 } else if (sender == spoken_feedback_view_) { 253 } else if (sender == spoken_feedback_view_) {
254 WmShell::Get()->RecordUserMetricsAction( 254 WmShell::Get()->RecordUserMetricsAction(
255 delegate->IsSpokenFeedbackEnabled() 255 delegate->IsSpokenFeedbackEnabled()
256 ? ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK 256 ? ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK
257 : ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK); 257 : ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK);
258 delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); 258 delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE);
259 } else if (sender == high_contrast_view_) { 259 } else if (sender == high_contrast_view_) {
260 WmShell::Get()->RecordUserMetricsAction( 260 WmShell::Get()->RecordUserMetricsAction(
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 } 337 }
338 338
339 views::View* TrayAccessibility::CreateDefaultView(LoginStatus status) { 339 views::View* TrayAccessibility::CreateDefaultView(LoginStatus status) {
340 CHECK(default_ == NULL); 340 CHECK(default_ == NULL);
341 341
342 // Shows accessibility menu if: 342 // Shows accessibility menu if:
343 // - on login screen (not logged in); 343 // - on login screen (not logged in);
344 // - "Enable accessibility menu" on chrome://settings is checked; 344 // - "Enable accessibility menu" on chrome://settings is checked;
345 // - or any of accessibility features is enabled 345 // - or any of accessibility features is enabled
346 // Otherwise, not shows it. 346 // Otherwise, not shows it.
347 AccessibilityDelegate* delegate = WmShell::Get()->GetAccessibilityDelegate(); 347 AccessibilityDelegate* delegate = WmShell::Get()->accessibility_delegate();
348 if (login_ != LoginStatus::NOT_LOGGED_IN && 348 if (login_ != LoginStatus::NOT_LOGGED_IN &&
349 !delegate->ShouldShowAccessibilityMenu() && 349 !delegate->ShouldShowAccessibilityMenu() &&
350 // On login screen, keeps the initial visibility of the menu. 350 // On login screen, keeps the initial visibility of the menu.
351 (status != LoginStatus::LOCKED || !show_a11y_menu_on_lock_screen_)) 351 (status != LoginStatus::LOCKED || !show_a11y_menu_on_lock_screen_))
352 return NULL; 352 return NULL;
353 353
354 CHECK(default_ == NULL); 354 CHECK(default_ == NULL);
355 default_ = new tray::DefaultAccessibilityView(this); 355 default_ = new tray::DefaultAccessibilityView(this);
356 356
357 return default_; 357 return default_;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 if (detailed_popup_) 417 if (detailed_popup_)
418 detailed_popup_->GetWidget()->Close(); 418 detailed_popup_->GetWidget()->Close();
419 if (detailed_menu_) 419 if (detailed_menu_)
420 detailed_menu_->GetWidget()->Close(); 420 detailed_menu_->GetWidget()->Close();
421 } 421 }
422 422
423 previous_accessibility_state_ = accessibility_state; 423 previous_accessibility_state_ = accessibility_state;
424 } 424 }
425 425
426 } // namespace ash 426 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/system_tray_unittest.cc ('k') | ash/common/wm/overview/window_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698