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 14 matching lines...) Expand all Loading... | |
25 #include "ash/strings/grit/ash_strings.h" | 25 #include "ash/strings/grit/ash_strings.h" |
26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
29 #include "ui/gfx/color_palette.h" | 29 #include "ui/gfx/color_palette.h" |
30 #include "ui/gfx/image/image.h" | 30 #include "ui/gfx/image/image.h" |
31 #include "ui/gfx/paint_vector_icon.h" | 31 #include "ui/gfx/paint_vector_icon.h" |
32 #include "ui/views/controls/button/custom_button.h" | 32 #include "ui/views/controls/button/custom_button.h" |
33 #include "ui/views/controls/image_view.h" | 33 #include "ui/views/controls/image_view.h" |
34 #include "ui/views/controls/label.h" | 34 #include "ui/views/controls/label.h" |
35 #include "ui/views/controls/separator.h" | |
35 #include "ui/views/layout/box_layout.h" | 36 #include "ui/views/layout/box_layout.h" |
36 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
37 | 38 |
38 namespace ash { | 39 namespace ash { |
39 namespace { | 40 namespace { |
40 | 41 |
41 enum AccessibilityState { | 42 enum AccessibilityState { |
42 A11Y_NONE = 0, | 43 A11Y_NONE = 0, |
43 A11Y_SPOKEN_FEEDBACK = 1 << 0, | 44 A11Y_SPOKEN_FEEDBACK = 1 << 0, |
44 A11Y_HIGH_CONTRAST = 1 << 1, | 45 A11Y_HIGH_CONTRAST = 1 << 1, |
45 A11Y_SCREEN_MAGNIFIER = 1 << 2, | 46 A11Y_SCREEN_MAGNIFIER = 1 << 2, |
46 A11Y_LARGE_CURSOR = 1 << 3, | 47 A11Y_LARGE_CURSOR = 1 << 3, |
47 A11Y_AUTOCLICK = 1 << 4, | 48 A11Y_AUTOCLICK = 1 << 4, |
48 A11Y_VIRTUAL_KEYBOARD = 1 << 5, | 49 A11Y_VIRTUAL_KEYBOARD = 1 << 5, |
49 A11Y_BRAILLE_DISPLAY_CONNECTED = 1 << 6, | 50 A11Y_BRAILLE_DISPLAY_CONNECTED = 1 << 6, |
51 A11Y_MONO_AUDIO = 1 << 7, | |
52 A11Y_CARET_HIGHLIGHT = 1 << 8, | |
53 A11Y_HIGHLIGHT_MOUSE_CURSOR = 1 << 9, | |
54 A11Y_HIGHLIGHT_KEYBOARD_FOCUS = 1 << 10, | |
50 }; | 55 }; |
51 | 56 |
52 uint32_t GetAccessibilityState() { | 57 uint32_t GetAccessibilityState() { |
53 AccessibilityDelegate* delegate = | 58 AccessibilityDelegate* delegate = |
54 Shell::GetInstance()->accessibility_delegate(); | 59 Shell::GetInstance()->accessibility_delegate(); |
55 uint32_t state = A11Y_NONE; | 60 uint32_t state = A11Y_NONE; |
56 if (delegate->IsSpokenFeedbackEnabled()) | 61 if (delegate->IsSpokenFeedbackEnabled()) |
57 state |= A11Y_SPOKEN_FEEDBACK; | 62 state |= A11Y_SPOKEN_FEEDBACK; |
58 if (delegate->IsHighContrastEnabled()) | 63 if (delegate->IsHighContrastEnabled()) |
59 state |= A11Y_HIGH_CONTRAST; | 64 state |= A11Y_HIGH_CONTRAST; |
60 if (delegate->IsMagnifierEnabled()) | 65 if (delegate->IsMagnifierEnabled()) |
61 state |= A11Y_SCREEN_MAGNIFIER; | 66 state |= A11Y_SCREEN_MAGNIFIER; |
62 if (delegate->IsLargeCursorEnabled()) | 67 if (delegate->IsLargeCursorEnabled()) |
63 state |= A11Y_LARGE_CURSOR; | 68 state |= A11Y_LARGE_CURSOR; |
64 if (delegate->IsAutoclickEnabled()) | 69 if (delegate->IsAutoclickEnabled()) |
65 state |= A11Y_AUTOCLICK; | 70 state |= A11Y_AUTOCLICK; |
66 if (delegate->IsVirtualKeyboardEnabled()) | 71 if (delegate->IsVirtualKeyboardEnabled()) |
67 state |= A11Y_VIRTUAL_KEYBOARD; | 72 state |= A11Y_VIRTUAL_KEYBOARD; |
68 if (delegate->IsBrailleDisplayConnected()) | 73 if (delegate->IsBrailleDisplayConnected()) |
69 state |= A11Y_BRAILLE_DISPLAY_CONNECTED; | 74 state |= A11Y_BRAILLE_DISPLAY_CONNECTED; |
75 if (delegate->IsMonoAudioEnabled()) | |
76 state |= A11Y_MONO_AUDIO; | |
77 if (delegate->IsCaretHighlightEnabled()) | |
78 state |= A11Y_CARET_HIGHLIGHT; | |
79 if (delegate->IsCursorHighlightEnabled()) | |
80 state |= A11Y_HIGHLIGHT_MOUSE_CURSOR; | |
81 if (delegate->IsFocusHighlightEnabled()) | |
82 state |= A11Y_HIGHLIGHT_KEYBOARD_FOCUS; | |
70 return state; | 83 return state; |
71 } | 84 } |
72 | 85 |
73 LoginStatus GetCurrentLoginStatus() { | 86 LoginStatus GetCurrentLoginStatus() { |
74 return Shell::Get()->system_tray_delegate()->GetUserLoginStatus(); | 87 return Shell::Get()->system_tray_delegate()->GetUserLoginStatus(); |
75 } | 88 } |
76 | 89 |
90 void UpdateCheckMark(HoverHighlightView* container, bool checked) { | |
tdanderson
2017/03/29 18:57:03
Thanks for moving this into a helper function.
It
| |
91 if (checked) { | |
92 gfx::ImageSkia check_mark = | |
93 CreateVectorIcon(kCheckCircleIcon, gfx::kGoogleGreen700); | |
94 container->AddRightIcon(check_mark, check_mark.width()); | |
95 container->SetRightViewVisible(true); | |
96 container->SetAccessiblityState( | |
97 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX); | |
98 } else { | |
99 container->SetAccessiblityState( | |
100 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); | |
101 } | |
102 } | |
xiyuan
2017/03/29 17:59:07
nit: insert a blank line after this line
| |
77 } // namespace | 103 } // namespace |
78 | 104 |
79 namespace tray { | 105 namespace tray { |
80 | 106 |
81 class DefaultAccessibilityView : public TrayItemMore { | 107 class DefaultAccessibilityView : public TrayItemMore { |
82 public: | 108 public: |
83 explicit DefaultAccessibilityView(SystemTrayItem* owner) | 109 explicit DefaultAccessibilityView(SystemTrayItem* owner) |
84 : TrayItemMore(owner) { | 110 : TrayItemMore(owner) { |
85 base::string16 label = | 111 base::string16 label = |
86 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY); | 112 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 158 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
133 return label; | 159 return label; |
134 } | 160 } |
135 | 161 |
136 //////////////////////////////////////////////////////////////////////////////// | 162 //////////////////////////////////////////////////////////////////////////////// |
137 // ash::tray::AccessibilityDetailedView | 163 // ash::tray::AccessibilityDetailedView |
138 | 164 |
139 AccessibilityDetailedView::AccessibilityDetailedView(SystemTrayItem* owner, | 165 AccessibilityDetailedView::AccessibilityDetailedView(SystemTrayItem* owner, |
140 LoginStatus login) | 166 LoginStatus login) |
141 : TrayDetailsView(owner), | 167 : TrayDetailsView(owner), |
142 spoken_feedback_view_(nullptr), | |
143 high_contrast_view_(nullptr), | |
144 screen_magnifier_view_(nullptr), | |
145 large_cursor_view_(nullptr), | |
146 help_view_(nullptr), | |
147 settings_view_(nullptr), | |
148 autoclick_view_(nullptr), | |
149 virtual_keyboard_view_(nullptr), | |
150 spoken_feedback_enabled_(false), | |
151 high_contrast_enabled_(false), | |
152 screen_magnifier_enabled_(false), | |
153 large_cursor_enabled_(false), | |
154 autoclick_enabled_(false), | |
155 virtual_keyboard_enabled_(false), | |
156 login_(login) { | 168 login_(login) { |
157 Reset(); | 169 Reset(); |
158 AppendAccessibilityList(); | 170 AppendAccessibilityList(); |
159 CreateTitleRow(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_TITLE); | 171 CreateTitleRow(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_TITLE); |
160 Layout(); | 172 Layout(); |
161 } | 173 } |
162 | 174 |
163 void AccessibilityDetailedView::AppendAccessibilityList() { | 175 void AccessibilityDetailedView::AppendAccessibilityList() { |
164 CreateScrollableList(); | 176 CreateScrollableList(); |
165 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 177 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
166 | 178 |
167 AccessibilityDelegate* delegate = | 179 AccessibilityDelegate* delegate = |
168 Shell::GetInstance()->accessibility_delegate(); | 180 Shell::GetInstance()->accessibility_delegate(); |
169 spoken_feedback_enabled_ = delegate->IsSpokenFeedbackEnabled(); | 181 spoken_feedback_enabled_ = delegate->IsSpokenFeedbackEnabled(); |
170 spoken_feedback_view_ = | 182 spoken_feedback_view_ = |
171 AddScrollListItem(bundle.GetLocalizedString( | 183 AddScrollListItem(bundle.GetLocalizedString( |
172 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SPOKEN_FEEDBACK), | 184 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SPOKEN_FEEDBACK), |
173 spoken_feedback_enabled_, spoken_feedback_enabled_, | 185 spoken_feedback_enabled_, spoken_feedback_enabled_, |
174 kSystemMenuAccessibilityChromevoxIcon); | 186 kSystemMenuAccessibilityChromevoxIcon); |
175 | 187 |
176 // Large Cursor item is shown only in Login screen. | |
177 if (login_ == LoginStatus::NOT_LOGGED_IN) { | |
178 large_cursor_enabled_ = delegate->IsLargeCursorEnabled(); | |
179 large_cursor_view_ = | |
180 AddScrollListItem(bundle.GetLocalizedString( | |
181 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_LARGE_CURSOR), | |
182 large_cursor_enabled_, large_cursor_enabled_, | |
183 kSystemMenuAccessibilityLargeCursorIcon); | |
184 } | |
185 | |
186 high_contrast_enabled_ = delegate->IsHighContrastEnabled(); | 188 high_contrast_enabled_ = delegate->IsHighContrastEnabled(); |
187 high_contrast_view_ = AddScrollListItem( | 189 high_contrast_view_ = AddScrollListItem( |
188 bundle.GetLocalizedString( | 190 bundle.GetLocalizedString( |
189 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE), | 191 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE), |
190 high_contrast_enabled_, high_contrast_enabled_, | 192 high_contrast_enabled_, high_contrast_enabled_, |
191 kSystemMenuAccessibilityContrastIcon); | 193 kSystemMenuAccessibilityContrastIcon); |
192 screen_magnifier_enabled_ = delegate->IsMagnifierEnabled(); | 194 screen_magnifier_enabled_ = delegate->IsMagnifierEnabled(); |
193 screen_magnifier_view_ = | 195 screen_magnifier_view_ = |
194 AddScrollListItem(bundle.GetLocalizedString( | 196 AddScrollListItem(bundle.GetLocalizedString( |
195 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER), | 197 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER), |
196 screen_magnifier_enabled_, screen_magnifier_enabled_, | 198 screen_magnifier_enabled_, screen_magnifier_enabled_, |
197 kSystemMenuAccessibilityScreenMagnifierIcon); | 199 kSystemMenuAccessibilityScreenMagnifierIcon); |
198 | 200 |
199 // Don't show autoclick option at login screen. | 201 autoclick_enabled_ = delegate->IsAutoclickEnabled(); |
200 if (login_ != LoginStatus::NOT_LOGGED_IN) { | 202 autoclick_view_ = AddScrollListItem( |
201 autoclick_enabled_ = delegate->IsAutoclickEnabled(); | 203 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_AUTOCLICK), |
202 autoclick_view_ = AddScrollListItem( | 204 autoclick_enabled_, autoclick_enabled_, |
203 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_AUTOCLICK), | 205 kSystemMenuAccessibilityAutoClickIcon); |
204 autoclick_enabled_, autoclick_enabled_, | |
205 kSystemMenuAccessibilityAutoClickIcon); | |
206 } | |
207 | 206 |
208 virtual_keyboard_enabled_ = delegate->IsVirtualKeyboardEnabled(); | 207 virtual_keyboard_enabled_ = delegate->IsVirtualKeyboardEnabled(); |
209 virtual_keyboard_view_ = | 208 virtual_keyboard_view_ = |
210 AddScrollListItem(bundle.GetLocalizedString( | 209 AddScrollListItem(bundle.GetLocalizedString( |
211 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD), | 210 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD), |
212 virtual_keyboard_enabled_, virtual_keyboard_enabled_, | 211 virtual_keyboard_enabled_, virtual_keyboard_enabled_, |
213 kSystemMenuKeyboardIcon); | 212 kSystemMenuKeyboardIcon); |
213 | |
214 AddSubHeader(l10n_util::GetStringUTF16( | |
215 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_ADDITIONAL_SETTINGS)); | |
216 | |
217 large_cursor_enabled_ = delegate->IsLargeCursorEnabled(); | |
218 large_cursor_view_ = AddScrollListItemWithoutIcon( | |
219 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_LARGE_CURSOR), | |
220 large_cursor_enabled_); | |
221 | |
222 mono_audio_enabled_ = delegate->IsMonoAudioEnabled(); | |
223 mono_audio_view_ = AddScrollListItemWithoutIcon( | |
224 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_MONO_AUDIO), | |
225 mono_audio_enabled_); | |
226 | |
227 caret_highlight_enabled_ = delegate->IsCaretHighlightEnabled(); | |
228 caret_highlight_view_ = AddScrollListItemWithoutIcon( | |
229 bundle.GetLocalizedString( | |
230 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_CARET_HIGHLIGHT), | |
231 caret_highlight_enabled_); | |
232 | |
233 highlight_mouse_cursor_enabled_ = delegate->IsCursorHighlightEnabled(); | |
234 highlight_mouse_cursor_view_ = AddScrollListItemWithoutIcon( | |
235 bundle.GetLocalizedString( | |
236 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGHLIGHT_MOUSE_CURSOR), | |
237 highlight_mouse_cursor_enabled_); | |
238 | |
239 // Focus highlighting can't be on when spoken | |
240 // feedback is on because ChromeVox does its own focus highlighting. | |
tdanderson
2017/03/29 18:57:03
Thanks for adding this comment, it's very helpful.
| |
241 if (!spoken_feedback_enabled_) { | |
242 highlight_keyboard_focus_enabled_ = delegate->IsFocusHighlightEnabled(); | |
243 highlight_keyboard_focus_view_ = AddScrollListItemWithoutIcon( | |
244 bundle.GetLocalizedString( | |
245 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGHLIGHT_KEYBOARD_FOCUS), | |
246 highlight_keyboard_focus_enabled_); | |
247 } | |
214 } | 248 } |
215 | 249 |
216 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( | 250 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( |
217 const base::string16& text, | 251 const base::string16& text, |
218 bool highlight, | 252 bool highlight, |
219 bool checked, | 253 bool checked, |
220 const gfx::VectorIcon& icon) { | 254 const gfx::VectorIcon& icon) { |
221 HoverHighlightView* container = new HoverHighlightView(this); | 255 HoverHighlightView* container = new HoverHighlightView(this); |
222 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); | 256 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); |
223 const int padding = (kMenuButtonSize - image.width()) / 2; | 257 const int padding = (kMenuButtonSize - image.width()) / 2; |
224 container->AddIconAndLabelCustomSize( | 258 container->AddIconAndLabelCustomSize( |
225 image, text, highlight, image.width() + kMenuSeparatorVerticalPadding * 2, | 259 image, text, highlight, image.width() + kMenuSeparatorVerticalPadding * 2, |
226 padding, padding); | 260 padding, padding); |
227 | 261 |
228 if (checked) { | 262 UpdateCheckMark(container, checked); |
229 gfx::ImageSkia check_mark = | |
230 CreateVectorIcon(kCheckCircleIcon, gfx::kGoogleGreen700); | |
231 container->AddRightIcon(check_mark, check_mark.width()); | |
232 container->SetRightViewVisible(true); | |
233 container->SetAccessiblityState( | |
234 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX); | |
235 } else { | |
236 container->SetAccessiblityState( | |
237 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); | |
238 } | |
239 | 263 |
240 scroll_content()->AddChildView(container); | 264 scroll_content()->AddChildView(container); |
241 return container; | 265 return container; |
242 } | 266 } |
243 | 267 |
268 HoverHighlightView* AccessibilityDetailedView::AddScrollListItemWithoutIcon( | |
269 const base::string16& text, | |
270 bool checked) { | |
271 HoverHighlightView* container = new HoverHighlightView(this); | |
272 container->AddLabelRowMd(text); | |
273 | |
274 UpdateCheckMark(container, checked); | |
275 | |
276 scroll_content()->AddChildView(container); | |
277 return container; | |
278 } | |
279 | |
280 void AccessibilityDetailedView::AddSubHeader( | |
281 const base::string16& header_text) { | |
282 TriView* header = TrayPopupUtils::CreateSubHeaderRowView(); | |
283 TrayPopupUtils::ConfigureAsStickyHeader(header); | |
284 | |
285 views::Label* label = TrayPopupUtils::CreateDefaultLabel(); | |
286 label->SetText(header_text); | |
287 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SUB_HEADER); | |
288 style.SetupLabel(label); | |
289 header->AddView(TriView::Container::CENTER, label); | |
290 | |
291 scroll_content()->AddChildView(new views::Separator()); | |
tdanderson
2017/03/29 18:57:03
Just instantiating a Separator() will not end up g
| |
292 scroll_content()->AddChildView(header); | |
293 } | |
294 | |
244 void AccessibilityDetailedView::HandleViewClicked(views::View* view) { | 295 void AccessibilityDetailedView::HandleViewClicked(views::View* view) { |
245 AccessibilityDelegate* delegate = | 296 AccessibilityDelegate* delegate = |
246 Shell::GetInstance()->accessibility_delegate(); | 297 Shell::GetInstance()->accessibility_delegate(); |
247 UserMetricsAction user_action; | 298 UserMetricsAction user_action; |
248 if (view == spoken_feedback_view_) { | 299 if (view == spoken_feedback_view_) { |
249 user_action = delegate->IsSpokenFeedbackEnabled() | 300 user_action = delegate->IsSpokenFeedbackEnabled() |
250 ? ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK | 301 ? ash::UMA_STATUS_AREA_DISABLE_SPOKEN_FEEDBACK |
251 : ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK; | 302 : ash::UMA_STATUS_AREA_ENABLE_SPOKEN_FEEDBACK; |
252 delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); | 303 delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); |
253 } else if (view == high_contrast_view_) { | 304 } else if (view == high_contrast_view_) { |
(...skipping 14 matching lines...) Expand all Loading... | |
268 } else if (autoclick_view_ && view == autoclick_view_) { | 319 } else if (autoclick_view_ && view == autoclick_view_) { |
269 user_action = delegate->IsAutoclickEnabled() | 320 user_action = delegate->IsAutoclickEnabled() |
270 ? ash::UMA_STATUS_AREA_DISABLE_AUTO_CLICK | 321 ? ash::UMA_STATUS_AREA_DISABLE_AUTO_CLICK |
271 : ash::UMA_STATUS_AREA_ENABLE_AUTO_CLICK; | 322 : ash::UMA_STATUS_AREA_ENABLE_AUTO_CLICK; |
272 delegate->SetAutoclickEnabled(!delegate->IsAutoclickEnabled()); | 323 delegate->SetAutoclickEnabled(!delegate->IsAutoclickEnabled()); |
273 } else if (virtual_keyboard_view_ && view == virtual_keyboard_view_) { | 324 } else if (virtual_keyboard_view_ && view == virtual_keyboard_view_) { |
274 user_action = delegate->IsVirtualKeyboardEnabled() | 325 user_action = delegate->IsVirtualKeyboardEnabled() |
275 ? ash::UMA_STATUS_AREA_DISABLE_VIRTUAL_KEYBOARD | 326 ? ash::UMA_STATUS_AREA_DISABLE_VIRTUAL_KEYBOARD |
276 : ash::UMA_STATUS_AREA_ENABLE_VIRTUAL_KEYBOARD; | 327 : ash::UMA_STATUS_AREA_ENABLE_VIRTUAL_KEYBOARD; |
277 delegate->SetVirtualKeyboardEnabled(!delegate->IsVirtualKeyboardEnabled()); | 328 delegate->SetVirtualKeyboardEnabled(!delegate->IsVirtualKeyboardEnabled()); |
329 } else if (caret_highlight_view_ && view == caret_highlight_view_) { | |
330 user_action = delegate->IsCaretHighlightEnabled() | |
331 ? ash::UMA_STATUS_AREA_DISABLE_CARET_HIGHLIGHT | |
332 : ash::UMA_STATUS_AREA_ENABLE_CARET_HIGHLIGHT; | |
333 delegate->SetCaretHighlightEnabled(!delegate->IsCaretHighlightEnabled()); | |
334 } else if (mono_audio_view_ && view == mono_audio_view_) { | |
335 user_action = delegate->IsMonoAudioEnabled() | |
336 ? ash::UMA_STATUS_AREA_DISABLE_MONO_AUDIO | |
337 : ash::UMA_STATUS_AREA_ENABLE_MONO_AUDIO; | |
338 delegate->SetMonoAudioEnabled(!delegate->IsMonoAudioEnabled()); | |
339 } else if (highlight_mouse_cursor_view_ && | |
340 view == highlight_mouse_cursor_view_) { | |
341 user_action = delegate->IsCursorHighlightEnabled() | |
342 ? ash::UMA_STATUS_AREA_DISABLE_HIGHLIGHT_MOUSE_CURSOR | |
343 : ash::UMA_STATUS_AREA_ENABLE_HIGHLIGHT_MOUSE_CURSOR; | |
344 delegate->SetCursorHighlightEnabled(!delegate->IsCursorHighlightEnabled()); | |
345 } else if (highlight_keyboard_focus_view_ && | |
346 view == highlight_keyboard_focus_view_) { | |
347 user_action = delegate->IsFocusHighlightEnabled() | |
348 ? ash::UMA_STATUS_AREA_DISABLE_HIGHLIGHT_KEYBOARD_FOCUS | |
349 : ash::UMA_STATUS_AREA_ENABLE_HIGHLIGHT_KEYBOARD_FOCUS; | |
350 delegate->SetFocusHighlightEnabled(!delegate->IsFocusHighlightEnabled()); | |
278 } else { | 351 } else { |
279 return; | 352 return; |
280 } | 353 } |
281 WmShell::Get()->RecordUserMetricsAction(user_action); | 354 WmShell::Get()->RecordUserMetricsAction(user_action); |
282 } | 355 } |
283 | 356 |
284 void AccessibilityDetailedView::HandleButtonPressed(views::Button* sender, | 357 void AccessibilityDetailedView::HandleButtonPressed(views::Button* sender, |
285 const ui::Event& event) { | 358 const ui::Event& event) { |
286 if (sender == help_view_) | 359 if (sender == help_view_) |
287 ShowHelp(); | 360 ShowHelp(); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 if (detailed_popup_) | 512 if (detailed_popup_) |
440 detailed_popup_->GetWidget()->Close(); | 513 detailed_popup_->GetWidget()->Close(); |
441 if (detailed_menu_) | 514 if (detailed_menu_) |
442 detailed_menu_->GetWidget()->Close(); | 515 detailed_menu_->GetWidget()->Close(); |
443 } | 516 } |
444 | 517 |
445 previous_accessibility_state_ = accessibility_state; | 518 previous_accessibility_state_ = accessibility_state; |
446 } | 519 } |
447 | 520 |
448 } // namespace ash | 521 } // namespace ash |
OLD | NEW |