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/system/tray/hover_highlight_view.h" | 5 #include "ash/system/tray/hover_highlight_view.h" |
6 | 6 |
7 #include "ash/resources/vector_icons/vector_icons.h" | 7 #include "ash/resources/vector_icons/vector_icons.h" |
8 #include "ash/system/tray/tray_constants.h" | 8 #include "ash/system/tray/tray_constants.h" |
9 #include "ash/system/tray/tray_popup_utils.h" | 9 #include "ash/system/tray/tray_popup_utils.h" |
10 #include "ash/system/tray/tri_view.h" | 10 #include "ash/system/tray/tri_view.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 else if (accessibility_state_ == AccessibilityState::UNCHECKED_CHECKBOX) | 203 else if (accessibility_state_ == AccessibilityState::UNCHECKED_CHECKBOX) |
204 checked_state = ui::AX_CHECKED_STATE_FALSE; | 204 checked_state = ui::AX_CHECKED_STATE_FALSE; |
205 else | 205 else |
206 return; // Not a checkbox | 206 return; // Not a checkbox |
207 | 207 |
208 // Checkbox | 208 // Checkbox |
209 node_data->role = ui::AX_ROLE_CHECK_BOX; | 209 node_data->role = ui::AX_ROLE_CHECK_BOX; |
210 node_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checked_state); | 210 node_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checked_state); |
211 } | 211 } |
212 | 212 |
213 gfx::Size HoverHighlightView::GetPreferredSize() const { | 213 gfx::Size HoverHighlightView::CalculatePreferredSize() const { |
214 gfx::Size size = ActionableView::GetPreferredSize(); | 214 gfx::Size size = ActionableView::GetPreferredSize(); |
215 | 215 |
216 if (!expandable_ || size.height() < kTrayPopupItemMinHeight) | 216 if (!expandable_ || size.height() < kTrayPopupItemMinHeight) |
217 size.set_height(kTrayPopupItemMinHeight); | 217 size.set_height(kTrayPopupItemMinHeight); |
218 | 218 |
219 return size; | 219 return size; |
220 } | 220 } |
221 | 221 |
222 int HoverHighlightView::GetHeightForWidth(int width) const { | 222 int HoverHighlightView::GetHeightForWidth(int width) const { |
223 return GetPreferredSize().height(); | 223 return GetPreferredSize().height(); |
224 } | 224 } |
225 | 225 |
226 void HoverHighlightView::OnEnabledChanged() { | 226 void HoverHighlightView::OnEnabledChanged() { |
227 if (left_icon_) | 227 if (left_icon_) |
228 left_icon_->SetEnabled(enabled()); | 228 left_icon_->SetEnabled(enabled()); |
229 if (text_label_) | 229 if (text_label_) |
230 text_label_->SetEnabled(enabled()); | 230 text_label_->SetEnabled(enabled()); |
231 if (right_view_) | 231 if (right_view_) |
232 right_view_->SetEnabled(enabled()); | 232 right_view_->SetEnabled(enabled()); |
233 } | 233 } |
234 | 234 |
235 void HoverHighlightView::OnFocus() { | 235 void HoverHighlightView::OnFocus() { |
236 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); | 236 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); |
237 ActionableView::OnFocus(); | 237 ActionableView::OnFocus(); |
238 } | 238 } |
239 | 239 |
240 } // namespace ash | 240 } // namespace ash |
OLD | NEW |