| 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/system/tray/fixed_sized_image_view.h" | 7 #include "ash/common/system/tray/fixed_sized_image_view.h" |
| 8 #include "ash/common/system/tray/tray_constants.h" | 8 #include "ash/common/system/tray/tray_constants.h" |
| 9 #include "ash/common/system/tray/view_click_listener.h" | 9 #include "ash/common/system/tray/view_click_listener.h" |
| 10 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_node_data.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 12 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
| 13 #include "ui/gfx/font_list.h" | 13 #include "ui/gfx/font_list.h" |
| 14 #include "ui/resources/grit/ui_resources.h" | 14 #include "ui/resources/grit/ui_resources.h" |
| 15 #include "ui/views/border.h" | 15 #include "ui/views/border.h" |
| 16 #include "ui/views/controls/image_view.h" | 16 #include "ui/views/controls/image_view.h" |
| 17 #include "ui/views/controls/label.h" | 17 #include "ui/views/controls/label.h" |
| 18 #include "ui/views/layout/box_layout.h" | 18 #include "ui/views/layout/box_layout.h" |
| 19 #include "ui/views/layout/fill_layout.h" | 19 #include "ui/views/layout/fill_layout.h" |
| 20 #include "ui/views/resources/grit/views_resources.h" | 20 #include "ui/views/resources/grit/views_resources.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 SchedulePaint(); | 214 SchedulePaint(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 bool HoverHighlightView::PerformAction(const ui::Event& event) { | 217 bool HoverHighlightView::PerformAction(const ui::Event& event) { |
| 218 if (!listener_) | 218 if (!listener_) |
| 219 return false; | 219 return false; |
| 220 listener_->OnViewClicked(this); | 220 listener_->OnViewClicked(this); |
| 221 return true; | 221 return true; |
| 222 } | 222 } |
| 223 | 223 |
| 224 void HoverHighlightView::GetAccessibleState(ui::AXViewState* state) { | 224 void HoverHighlightView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 225 ActionableView::GetAccessibleState(state); | 225 ActionableView::GetAccessibleNodeData(node_data); |
| 226 | 226 |
| 227 if (accessibility_state_ == AccessibilityState::CHECKED_CHECKBOX || | 227 if (accessibility_state_ == AccessibilityState::CHECKED_CHECKBOX || |
| 228 accessibility_state_ == AccessibilityState::UNCHECKED_CHECKBOX) { | 228 accessibility_state_ == AccessibilityState::UNCHECKED_CHECKBOX) { |
| 229 state->role = ui::AX_ROLE_CHECK_BOX; | 229 node_data->role = ui::AX_ROLE_CHECK_BOX; |
| 230 } | 230 } |
| 231 | 231 |
| 232 if (accessibility_state_ == AccessibilityState::CHECKED_CHECKBOX) | 232 if (accessibility_state_ == AccessibilityState::CHECKED_CHECKBOX) |
| 233 state->AddStateFlag(ui::AX_STATE_CHECKED); | 233 node_data->AddStateFlag(ui::AX_STATE_CHECKED); |
| 234 } | 234 } |
| 235 | 235 |
| 236 gfx::Size HoverHighlightView::GetPreferredSize() const { | 236 gfx::Size HoverHighlightView::GetPreferredSize() const { |
| 237 gfx::Size size = ActionableView::GetPreferredSize(); | 237 gfx::Size size = ActionableView::GetPreferredSize(); |
| 238 const int default_height = GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT); | 238 const int default_height = GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT); |
| 239 | 239 |
| 240 if (custom_height_) | 240 if (custom_height_) |
| 241 size.set_height(custom_height_); | 241 size.set_height(custom_height_); |
| 242 else if (!expandable_ || size.height() < default_height) | 242 else if (!expandable_ || size.height() < default_height) |
| 243 size.set_height(default_height); | 243 size.set_height(default_height); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { | 281 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { |
| 282 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); | 282 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void HoverHighlightView::OnFocus() { | 285 void HoverHighlightView::OnFocus() { |
| 286 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); | 286 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); |
| 287 ActionableView::OnFocus(); | 287 ActionableView::OnFocus(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace ash | 290 } // namespace ash |
| OLD | NEW |