| 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/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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 238 } |
| 239 | 239 |
| 240 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( | 240 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( |
| 241 const base::string16& text, | 241 const base::string16& text, |
| 242 bool highlight, | 242 bool highlight, |
| 243 bool checked, | 243 bool checked, |
| 244 const gfx::VectorIcon& icon) { | 244 const gfx::VectorIcon& icon) { |
| 245 HoverHighlightView* container = new HoverHighlightView(this); | 245 HoverHighlightView* container = new HoverHighlightView(this); |
| 246 if (UseMdMenu()) { | 246 if (UseMdMenu()) { |
| 247 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); | 247 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); |
| 248 const int padding = (kMenuButtonSize - image.width()) / 2; | 248 container->AddIconAndLabel(image, text); |
| 249 container->AddIconAndLabelCustomSize( | |
| 250 image, text, highlight, | |
| 251 image.width() + kMenuSeparatorVerticalPadding * 2, padding, padding); | |
| 252 if (checked) { | 249 if (checked) { |
| 253 gfx::ImageSkia check_mark = CreateVectorIcon( | 250 gfx::ImageSkia check_mark = CreateVectorIcon( |
| 254 gfx::VectorIconId::CHECK_CIRCLE, gfx::kGoogleGreen700); | 251 gfx::VectorIconId::CHECK_CIRCLE, gfx::kGoogleGreen700); |
| 255 container->AddRightIcon(check_mark, check_mark.width()); | 252 container->AddRightIcon(check_mark, check_mark.width()); |
| 256 container->SetRightViewVisible(true); | 253 container->SetRightViewVisible(true); |
| 257 container->SetAccessiblityState( | 254 container->SetAccessiblityState( |
| 258 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX); | 255 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX); |
| 259 } else { | 256 } else { |
| 260 container->SetAccessiblityState( | 257 container->SetAccessiblityState( |
| 261 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); | 258 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); |
| 262 } | 259 } |
| 263 } else { | |
| 264 container->AddCheckableLabel(text, highlight, checked); | |
| 265 } | 260 } |
| 266 scroll_content()->AddChildView(container); | 261 scroll_content()->AddChildView(container); |
| 267 return container; | 262 return container; |
| 268 } | 263 } |
| 269 | 264 |
| 270 void AccessibilityDetailedView::HandleViewClicked(views::View* view) { | 265 void AccessibilityDetailedView::HandleViewClicked(views::View* view) { |
| 271 AccessibilityDelegate* delegate = WmShell::Get()->accessibility_delegate(); | 266 AccessibilityDelegate* delegate = WmShell::Get()->accessibility_delegate(); |
| 272 UserMetricsAction user_action; | 267 UserMetricsAction user_action; |
| 273 if (view == spoken_feedback_view_) { | 268 if (view == spoken_feedback_view_) { |
| 274 user_action = delegate->IsSpokenFeedbackEnabled() | 269 user_action = delegate->IsSpokenFeedbackEnabled() |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 if (detailed_popup_) | 459 if (detailed_popup_) |
| 465 detailed_popup_->GetWidget()->Close(); | 460 detailed_popup_->GetWidget()->Close(); |
| 466 if (detailed_menu_) | 461 if (detailed_menu_) |
| 467 detailed_menu_->GetWidget()->Close(); | 462 detailed_menu_->GetWidget()->Close(); |
| 468 } | 463 } |
| 469 | 464 |
| 470 previous_accessibility_state_ = accessibility_state; | 465 previous_accessibility_state_ = accessibility_state; |
| 471 } | 466 } |
| 472 | 467 |
| 473 } // namespace ash | 468 } // namespace ash |
| OLD | NEW |