OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/hover_highlight_view.h" | 5 #include "ash/common/system/tray/hover_highlight_view.h" |
6 | 6 |
7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
8 #include "ash/common/system/tray/fixed_sized_image_view.h" | 8 #include "ash/common/system/tray/fixed_sized_image_view.h" |
9 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
10 #include "ash/common/system/tray/tray_popup_utils.h" | 10 #include "ash/common/system/tray/tray_popup_utils.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 bool HoverHighlightView::PerformAction(const ui::Event& event) { | 315 bool HoverHighlightView::PerformAction(const ui::Event& event) { |
316 if (!listener_) | 316 if (!listener_) |
317 return false; | 317 return false; |
318 listener_->OnViewClicked(this); | 318 listener_->OnViewClicked(this); |
319 return true; | 319 return true; |
320 } | 320 } |
321 | 321 |
322 void HoverHighlightView::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 322 void HoverHighlightView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
323 ActionableView::GetAccessibleNodeData(node_data); | 323 ActionableView::GetAccessibleNodeData(node_data); |
324 | 324 |
325 if (accessibility_state_ == AccessibilityState::CHECKED_CHECKBOX || | 325 ui::AXCheckedState checked_state; |
326 accessibility_state_ == AccessibilityState::UNCHECKED_CHECKBOX) { | 326 if (accessibility_state_ == AccessibilityState::CHECKED_CHECKBOX) |
327 node_data->role = ui::AX_ROLE_CHECK_BOX; | 327 checked_state = ui::AX_CHECKED_STATE_TRUE; |
328 } | 328 else if (accessibility_state_ == AccessibilityState::UNCHECKED_CHECKBOX) |
| 329 checked_state = ui::AX_CHECKED_STATE_FALSE; |
| 330 else |
| 331 return; // Not a checkbox |
329 | 332 |
330 if (accessibility_state_ == AccessibilityState::CHECKED_CHECKBOX) | 333 // Checkbox |
331 node_data->AddStateFlag(ui::AX_STATE_CHECKED); | 334 node_data->role = ui::AX_ROLE_CHECK_BOX; |
| 335 node_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checked_state); |
332 } | 336 } |
333 | 337 |
334 gfx::Size HoverHighlightView::GetPreferredSize() const { | 338 gfx::Size HoverHighlightView::GetPreferredSize() const { |
335 gfx::Size size = ActionableView::GetPreferredSize(); | 339 gfx::Size size = ActionableView::GetPreferredSize(); |
336 | 340 |
337 if (custom_height_) | 341 if (custom_height_) |
338 size.set_height(custom_height_); | 342 size.set_height(custom_height_); |
339 else if (!expandable_ || size.height() < kTrayPopupItemMinHeight) | 343 else if (!expandable_ || size.height() < kTrayPopupItemMinHeight) |
340 size.set_height(kTrayPopupItemMinHeight); | 344 size.set_height(kTrayPopupItemMinHeight); |
341 | 345 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { | 391 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { |
388 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); | 392 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); |
389 } | 393 } |
390 | 394 |
391 void HoverHighlightView::OnFocus() { | 395 void HoverHighlightView::OnFocus() { |
392 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); | 396 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); |
393 ActionableView::OnFocus(); | 397 ActionableView::OnFocus(); |
394 } | 398 } |
395 | 399 |
396 } // namespace ash | 400 } // namespace ash |
OLD | NEW |