Chromium Code Reviews| 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/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/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/system/tray/hover_highlight_view.h" | 10 #include "ash/common/system/tray/hover_highlight_view.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 Layout(); | 223 Layout(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void AccessibilityDetailedView::AppendAccessibilityList() { | 226 void AccessibilityDetailedView::AppendAccessibilityList() { |
| 227 CreateScrollableList(); | 227 CreateScrollableList(); |
| 228 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 228 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 229 | 229 |
| 230 AccessibilityDelegate* delegate = | 230 AccessibilityDelegate* delegate = |
| 231 Shell::GetInstance()->accessibility_delegate(); | 231 Shell::GetInstance()->accessibility_delegate(); |
| 232 spoken_feedback_enabled_ = delegate->IsSpokenFeedbackEnabled(); | 232 spoken_feedback_enabled_ = delegate->IsSpokenFeedbackEnabled(); |
| 233 spoken_feedback_view_ = | 233 spoken_feedback_view_ = AddScrollListItem( |
| 234 AddScrollListItem(bundle.GetLocalizedString( | 234 bundle.GetLocalizedString( |
|
Evan Stade
2017/04/04 17:18:18
l10n_util::GetStringUTF16()
tdanderson
2017/04/04 18:45:06
Done.
| |
| 235 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SPOKEN_FEEDBACK), | 235 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SPOKEN_FEEDBACK), |
| 236 spoken_feedback_enabled_, spoken_feedback_enabled_, | 236 spoken_feedback_enabled_, kSystemMenuAccessibilityChromevoxIcon); |
| 237 kSystemMenuAccessibilityChromevoxIcon); | |
| 238 | 237 |
| 239 high_contrast_enabled_ = delegate->IsHighContrastEnabled(); | 238 high_contrast_enabled_ = delegate->IsHighContrastEnabled(); |
| 240 high_contrast_view_ = AddScrollListItem( | 239 high_contrast_view_ = AddScrollListItem( |
| 241 bundle.GetLocalizedString( | 240 bundle.GetLocalizedString( |
| 242 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE), | 241 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE), |
| 243 high_contrast_enabled_, high_contrast_enabled_, | 242 high_contrast_enabled_, kSystemMenuAccessibilityContrastIcon); |
| 244 kSystemMenuAccessibilityContrastIcon); | |
| 245 screen_magnifier_enabled_ = delegate->IsMagnifierEnabled(); | 243 screen_magnifier_enabled_ = delegate->IsMagnifierEnabled(); |
| 246 screen_magnifier_view_ = | 244 screen_magnifier_view_ = AddScrollListItem( |
| 247 AddScrollListItem(bundle.GetLocalizedString( | 245 bundle.GetLocalizedString( |
| 248 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER), | 246 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER), |
| 249 screen_magnifier_enabled_, screen_magnifier_enabled_, | 247 screen_magnifier_enabled_, kSystemMenuAccessibilityScreenMagnifierIcon); |
| 250 kSystemMenuAccessibilityScreenMagnifierIcon); | |
| 251 | 248 |
| 252 autoclick_enabled_ = delegate->IsAutoclickEnabled(); | 249 autoclick_enabled_ = delegate->IsAutoclickEnabled(); |
| 253 autoclick_view_ = AddScrollListItem( | 250 autoclick_view_ = AddScrollListItem( |
| 254 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_AUTOCLICK), | 251 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_AUTOCLICK), |
| 255 autoclick_enabled_, autoclick_enabled_, | 252 autoclick_enabled_, kSystemMenuAccessibilityAutoClickIcon); |
| 256 kSystemMenuAccessibilityAutoClickIcon); | |
| 257 | 253 |
| 258 virtual_keyboard_enabled_ = delegate->IsVirtualKeyboardEnabled(); | 254 virtual_keyboard_enabled_ = delegate->IsVirtualKeyboardEnabled(); |
| 259 virtual_keyboard_view_ = | 255 virtual_keyboard_view_ = |
| 260 AddScrollListItem(bundle.GetLocalizedString( | 256 AddScrollListItem(bundle.GetLocalizedString( |
| 261 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD), | 257 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD), |
| 262 virtual_keyboard_enabled_, virtual_keyboard_enabled_, | 258 virtual_keyboard_enabled_, kSystemMenuKeyboardIcon); |
| 263 kSystemMenuKeyboardIcon); | |
| 264 | 259 |
| 265 scroll_content()->AddChildView( | 260 scroll_content()->AddChildView( |
| 266 TrayPopupUtils::CreateListSubHeaderSeparator()); | 261 TrayPopupUtils::CreateListSubHeaderSeparator()); |
| 267 | 262 |
| 268 AddSubHeader(l10n_util::GetStringUTF16( | 263 AddSubHeader(l10n_util::GetStringUTF16( |
| 269 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_ADDITIONAL_SETTINGS)); | 264 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_ADDITIONAL_SETTINGS)); |
| 270 | 265 |
| 271 large_cursor_enabled_ = delegate->IsLargeCursorEnabled(); | 266 large_cursor_enabled_ = delegate->IsLargeCursorEnabled(); |
| 272 large_cursor_view_ = AddScrollListItemWithoutIcon( | 267 large_cursor_view_ = AddScrollListItemWithoutIcon( |
| 273 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_LARGE_CURSOR), | 268 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_LARGE_CURSOR), |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 296 highlight_keyboard_focus_enabled_ = delegate->IsFocusHighlightEnabled(); | 291 highlight_keyboard_focus_enabled_ = delegate->IsFocusHighlightEnabled(); |
| 297 highlight_keyboard_focus_view_ = AddScrollListItemWithoutIcon( | 292 highlight_keyboard_focus_view_ = AddScrollListItemWithoutIcon( |
| 298 bundle.GetLocalizedString( | 293 bundle.GetLocalizedString( |
| 299 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGHLIGHT_KEYBOARD_FOCUS), | 294 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGHLIGHT_KEYBOARD_FOCUS), |
| 300 highlight_keyboard_focus_enabled_); | 295 highlight_keyboard_focus_enabled_); |
| 301 } | 296 } |
| 302 } | 297 } |
| 303 | 298 |
| 304 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( | 299 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( |
| 305 const base::string16& text, | 300 const base::string16& text, |
| 306 bool highlight, | |
| 307 bool checked, | 301 bool checked, |
| 308 const gfx::VectorIcon& icon) { | 302 const gfx::VectorIcon& icon) { |
| 309 HoverHighlightView* container = new HoverHighlightView(this); | 303 HoverHighlightView* container = new HoverHighlightView(this); |
| 310 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); | 304 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); |
| 311 const int padding = (kMenuButtonSize - image.width()) / 2; | 305 container->AddIconAndLabel(image, text); |
| 312 container->AddIconAndLabelCustomSize( | |
| 313 image, text, highlight, image.width() + kMenuSeparatorVerticalPadding * 2, | |
| 314 padding, padding); | |
| 315 | |
| 316 UpdateCheckMark(container, checked); | 306 UpdateCheckMark(container, checked); |
| 317 | |
| 318 scroll_content()->AddChildView(container); | 307 scroll_content()->AddChildView(container); |
| 319 return container; | 308 return container; |
| 320 } | 309 } |
| 321 | 310 |
| 322 HoverHighlightView* AccessibilityDetailedView::AddScrollListItemWithoutIcon( | 311 HoverHighlightView* AccessibilityDetailedView::AddScrollListItemWithoutIcon( |
| 323 const base::string16& text, | 312 const base::string16& text, |
| 324 bool checked) { | 313 bool checked) { |
| 325 HoverHighlightView* container = new HoverHighlightView(this); | 314 HoverHighlightView* container = new HoverHighlightView(this); |
| 326 container->AddLabelRowMd(text); | 315 container->AddLabelRow(text); |
| 327 | 316 |
| 328 UpdateCheckMark(container, checked); | 317 UpdateCheckMark(container, checked); |
| 329 | 318 |
| 330 scroll_content()->AddChildView(container); | 319 scroll_content()->AddChildView(container); |
| 331 return container; | 320 return container; |
| 332 } | 321 } |
| 333 | 322 |
| 334 void AccessibilityDetailedView::AddSubHeader( | 323 void AccessibilityDetailedView::AddSubHeader( |
| 335 const base::string16& header_text) { | 324 const base::string16& header_text) { |
| 336 TriView* header = TrayPopupUtils::CreateSubHeaderRowView(); | 325 TriView* header = TrayPopupUtils::CreateSubHeaderRowView(); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 566 if (detailed_popup_) | 555 if (detailed_popup_) |
| 567 detailed_popup_->GetWidget()->Close(); | 556 detailed_popup_->GetWidget()->Close(); |
| 568 if (detailed_menu_) | 557 if (detailed_menu_) |
| 569 detailed_menu_->GetWidget()->Close(); | 558 detailed_menu_->GetWidget()->Close(); |
| 570 } | 559 } |
| 571 | 560 |
| 572 previous_accessibility_state_ = accessibility_state; | 561 previous_accessibility_state_ = accessibility_state; |
| 573 } | 562 } |
| 574 | 563 |
| 575 } // namespace ash | 564 } // namespace ash |
| OLD | NEW |