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

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

Issue 2795143005: [Ash] Remove pre-MD code paths from HoverHighlightView (Closed)
Patch Set: estade comments Created 3 years, 8 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
« no previous file with comments | « ash/common/system/tray_accessibility.h ('k') | no next file » | 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/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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 : label_(CreateLabel(enabled_state_bits)) {} 140 : label_(CreateLabel(enabled_state_bits)) {}
141 141
142 void AccessibilityPopupView::Init() { 142 void AccessibilityPopupView::Init() {
143 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); 143 set_background(views::Background::CreateSolidBackground(kBackgroundColor));
144 144
145 views::GridLayout* layout = new views::GridLayout(this); 145 views::GridLayout* layout = new views::GridLayout(this);
146 SetLayoutManager(layout); 146 SetLayoutManager(layout);
147 147
148 views::ImageView* close_button = new views::ImageView(); 148 views::ImageView* close_button = new views::ImageView();
149 close_button->SetImage( 149 close_button->SetImage(
150 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(IDR_MESSAGE_CLOSE)); 150 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(IDR_MESSAGE_CLOSE));
Evan Stade 2017/04/05 13:56:43 add TODO or file bug to fix this?
tdanderson 2017/04/05 14:24:39 AccessibilityPopupView will be ripped out as part
151 close_button->SetHorizontalAlignment(views::ImageView::CENTER); 151 close_button->SetHorizontalAlignment(views::ImageView::CENTER);
152 close_button->SetVerticalAlignment(views::ImageView::CENTER); 152 close_button->SetVerticalAlignment(views::ImageView::CENTER);
153 153
154 views::ImageView* icon = new views::ImageView; 154 views::ImageView* icon = new views::ImageView;
155 icon->SetImage( 155 icon->SetImage(
156 gfx::CreateVectorIcon(kSystemMenuAccessibilityIcon, kMenuIconColor)); 156 gfx::CreateVectorIcon(kSystemMenuAccessibilityIcon, kMenuIconColor));
157 157
158 views::ColumnSet* columns = layout->AddColumnSet(0); 158 views::ColumnSet* columns = layout->AddColumnSet(0);
159 159
160 columns->AddPaddingColumn(0, kTrayPopupPaddingHorizontal / 2); 160 columns->AddPaddingColumn(0, kTrayPopupPaddingHorizontal / 2);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 : TrayDetailsView(owner), 218 : TrayDetailsView(owner),
219 login_(login) { 219 login_(login) {
220 Reset(); 220 Reset();
221 AppendAccessibilityList(); 221 AppendAccessibilityList();
222 CreateTitleRow(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_TITLE); 222 CreateTitleRow(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_TITLE);
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();
229 228
230 AccessibilityDelegate* delegate = 229 AccessibilityDelegate* delegate =
231 Shell::GetInstance()->accessibility_delegate(); 230 Shell::GetInstance()->accessibility_delegate();
232 spoken_feedback_enabled_ = delegate->IsSpokenFeedbackEnabled(); 231 spoken_feedback_enabled_ = delegate->IsSpokenFeedbackEnabled();
233 spoken_feedback_view_ = 232 spoken_feedback_view_ = AddScrollListItem(
234 AddScrollListItem(bundle.GetLocalizedString( 233 l10n_util::GetStringUTF16(
235 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SPOKEN_FEEDBACK), 234 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SPOKEN_FEEDBACK),
236 spoken_feedback_enabled_, spoken_feedback_enabled_, 235 spoken_feedback_enabled_, kSystemMenuAccessibilityChromevoxIcon);
237 kSystemMenuAccessibilityChromevoxIcon);
238 236
239 high_contrast_enabled_ = delegate->IsHighContrastEnabled(); 237 high_contrast_enabled_ = delegate->IsHighContrastEnabled();
240 high_contrast_view_ = AddScrollListItem( 238 high_contrast_view_ = AddScrollListItem(
241 bundle.GetLocalizedString( 239 l10n_util::GetStringUTF16(
242 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE), 240 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE),
243 high_contrast_enabled_, high_contrast_enabled_, 241 high_contrast_enabled_, kSystemMenuAccessibilityContrastIcon);
244 kSystemMenuAccessibilityContrastIcon);
245 screen_magnifier_enabled_ = delegate->IsMagnifierEnabled(); 242 screen_magnifier_enabled_ = delegate->IsMagnifierEnabled();
246 screen_magnifier_view_ = 243 screen_magnifier_view_ = AddScrollListItem(
247 AddScrollListItem(bundle.GetLocalizedString( 244 l10n_util::GetStringUTF16(
248 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER), 245 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER),
249 screen_magnifier_enabled_, screen_magnifier_enabled_, 246 screen_magnifier_enabled_, kSystemMenuAccessibilityScreenMagnifierIcon);
250 kSystemMenuAccessibilityScreenMagnifierIcon);
251 247
252 autoclick_enabled_ = delegate->IsAutoclickEnabled(); 248 autoclick_enabled_ = delegate->IsAutoclickEnabled();
253 autoclick_view_ = AddScrollListItem( 249 autoclick_view_ = AddScrollListItem(
254 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_AUTOCLICK), 250 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_AUTOCLICK),
255 autoclick_enabled_, autoclick_enabled_, 251 autoclick_enabled_, kSystemMenuAccessibilityAutoClickIcon);
256 kSystemMenuAccessibilityAutoClickIcon);
257 252
258 virtual_keyboard_enabled_ = delegate->IsVirtualKeyboardEnabled(); 253 virtual_keyboard_enabled_ = delegate->IsVirtualKeyboardEnabled();
259 virtual_keyboard_view_ = 254 virtual_keyboard_view_ =
260 AddScrollListItem(bundle.GetLocalizedString( 255 AddScrollListItem(l10n_util::GetStringUTF16(
261 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD), 256 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD),
262 virtual_keyboard_enabled_, virtual_keyboard_enabled_, 257 virtual_keyboard_enabled_, kSystemMenuKeyboardIcon);
263 kSystemMenuKeyboardIcon);
264 258
265 scroll_content()->AddChildView( 259 scroll_content()->AddChildView(
266 TrayPopupUtils::CreateListSubHeaderSeparator()); 260 TrayPopupUtils::CreateListSubHeaderSeparator());
267 261
268 AddSubHeader(l10n_util::GetStringUTF16( 262 AddSubHeader(l10n_util::GetStringUTF16(
269 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_ADDITIONAL_SETTINGS)); 263 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_ADDITIONAL_SETTINGS));
270 264
271 large_cursor_enabled_ = delegate->IsLargeCursorEnabled(); 265 large_cursor_enabled_ = delegate->IsLargeCursorEnabled();
272 large_cursor_view_ = AddScrollListItemWithoutIcon( 266 large_cursor_view_ = AddScrollListItemWithoutIcon(
273 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_LARGE_CURSOR), 267 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_LARGE_CURSOR),
274 large_cursor_enabled_); 268 large_cursor_enabled_);
275 269
276 mono_audio_enabled_ = delegate->IsMonoAudioEnabled(); 270 mono_audio_enabled_ = delegate->IsMonoAudioEnabled();
277 mono_audio_view_ = AddScrollListItemWithoutIcon( 271 mono_audio_view_ = AddScrollListItemWithoutIcon(
278 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_MONO_AUDIO), 272 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_MONO_AUDIO),
279 mono_audio_enabled_); 273 mono_audio_enabled_);
280 274
281 caret_highlight_enabled_ = delegate->IsCaretHighlightEnabled(); 275 caret_highlight_enabled_ = delegate->IsCaretHighlightEnabled();
282 caret_highlight_view_ = AddScrollListItemWithoutIcon( 276 caret_highlight_view_ = AddScrollListItemWithoutIcon(
283 bundle.GetLocalizedString( 277 l10n_util::GetStringUTF16(
284 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_CARET_HIGHLIGHT), 278 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_CARET_HIGHLIGHT),
285 caret_highlight_enabled_); 279 caret_highlight_enabled_);
286 280
287 highlight_mouse_cursor_enabled_ = delegate->IsCursorHighlightEnabled(); 281 highlight_mouse_cursor_enabled_ = delegate->IsCursorHighlightEnabled();
288 highlight_mouse_cursor_view_ = AddScrollListItemWithoutIcon( 282 highlight_mouse_cursor_view_ = AddScrollListItemWithoutIcon(
289 bundle.GetLocalizedString( 283 l10n_util::GetStringUTF16(
290 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGHLIGHT_MOUSE_CURSOR), 284 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGHLIGHT_MOUSE_CURSOR),
291 highlight_mouse_cursor_enabled_); 285 highlight_mouse_cursor_enabled_);
292 286
293 // Focus highlighting can't be on when spoken feedback is on because 287 // Focus highlighting can't be on when spoken feedback is on because
294 // ChromeVox does its own focus highlighting. 288 // ChromeVox does its own focus highlighting.
295 if (!spoken_feedback_enabled_) { 289 if (!spoken_feedback_enabled_) {
296 highlight_keyboard_focus_enabled_ = delegate->IsFocusHighlightEnabled(); 290 highlight_keyboard_focus_enabled_ = delegate->IsFocusHighlightEnabled();
297 highlight_keyboard_focus_view_ = AddScrollListItemWithoutIcon( 291 highlight_keyboard_focus_view_ = AddScrollListItemWithoutIcon(
298 bundle.GetLocalizedString( 292 l10n_util::GetStringUTF16(
299 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGHLIGHT_KEYBOARD_FOCUS), 293 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGHLIGHT_KEYBOARD_FOCUS),
300 highlight_keyboard_focus_enabled_); 294 highlight_keyboard_focus_enabled_);
301 } 295 }
302 } 296 }
303 297
304 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( 298 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem(
305 const base::string16& text, 299 const base::string16& text,
306 bool highlight,
307 bool checked, 300 bool checked,
308 const gfx::VectorIcon& icon) { 301 const gfx::VectorIcon& icon) {
309 HoverHighlightView* container = new HoverHighlightView(this); 302 HoverHighlightView* container = new HoverHighlightView(this);
310 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); 303 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor);
311 const int padding = (kMenuButtonSize - image.width()) / 2; 304 container->AddIconAndLabel(image, text);
312 container->AddIconAndLabelCustomSize(
313 image, text, highlight, image.width() + kMenuSeparatorVerticalPadding * 2,
314 padding, padding);
315
316 UpdateCheckMark(container, checked); 305 UpdateCheckMark(container, checked);
317
318 scroll_content()->AddChildView(container); 306 scroll_content()->AddChildView(container);
319 return container; 307 return container;
320 } 308 }
321 309
322 HoverHighlightView* AccessibilityDetailedView::AddScrollListItemWithoutIcon( 310 HoverHighlightView* AccessibilityDetailedView::AddScrollListItemWithoutIcon(
323 const base::string16& text, 311 const base::string16& text,
324 bool checked) { 312 bool checked) {
325 HoverHighlightView* container = new HoverHighlightView(this); 313 HoverHighlightView* container = new HoverHighlightView(this);
326 container->AddLabelRowMd(text); 314 container->AddLabelRow(text);
327 315
328 UpdateCheckMark(container, checked); 316 UpdateCheckMark(container, checked);
329 317
330 scroll_content()->AddChildView(container); 318 scroll_content()->AddChildView(container);
331 return container; 319 return container;
332 } 320 }
333 321
334 void AccessibilityDetailedView::AddSubHeader( 322 void AccessibilityDetailedView::AddSubHeader(
335 const base::string16& header_text) { 323 const base::string16& header_text) {
336 TriView* header = TrayPopupUtils::CreateSubHeaderRowView(); 324 TriView* header = TrayPopupUtils::CreateSubHeaderRowView();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 if (detailed_popup_) 554 if (detailed_popup_)
567 detailed_popup_->GetWidget()->Close(); 555 detailed_popup_->GetWidget()->Close();
568 if (detailed_menu_) 556 if (detailed_menu_)
569 detailed_menu_->GetWidget()->Close(); 557 detailed_menu_->GetWidget()->Close();
570 } 558 }
571 559
572 previous_accessibility_state_ = accessibility_state; 560 previous_accessibility_state_ = accessibility_state;
573 } 561 }
574 562
575 } // namespace ash 563 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray_accessibility.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698