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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 accessibility_state_ == AccessibilityState::UNCHECKED_CHECKBOX) { | 366 accessibility_state_ == AccessibilityState::UNCHECKED_CHECKBOX) { |
367 node_data->role = ui::AX_ROLE_CHECK_BOX; | 367 node_data->role = ui::AX_ROLE_CHECK_BOX; |
368 } | 368 } |
369 | 369 |
370 if (accessibility_state_ == AccessibilityState::CHECKED_CHECKBOX) | 370 if (accessibility_state_ == AccessibilityState::CHECKED_CHECKBOX) |
371 node_data->AddStateFlag(ui::AX_STATE_CHECKED); | 371 node_data->AddStateFlag(ui::AX_STATE_CHECKED); |
372 } | 372 } |
373 | 373 |
374 gfx::Size HoverHighlightView::GetPreferredSize() const { | 374 gfx::Size HoverHighlightView::GetPreferredSize() const { |
375 gfx::Size size = ActionableView::GetPreferredSize(); | 375 gfx::Size size = ActionableView::GetPreferredSize(); |
376 const int default_height = GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT); | |
377 | 376 |
378 if (custom_height_) | 377 if (custom_height_) |
379 size.set_height(custom_height_); | 378 size.set_height(custom_height_); |
380 else if (!expandable_ || size.height() < default_height) | 379 else if (!expandable_ || size.height() < kTrayPopupItemMinHeight) |
381 size.set_height(default_height); | 380 size.set_height(kTrayPopupItemMinHeight); |
382 | 381 |
383 return size; | 382 return size; |
384 } | 383 } |
385 | 384 |
386 int HoverHighlightView::GetHeightForWidth(int width) const { | 385 int HoverHighlightView::GetHeightForWidth(int width) const { |
387 return GetPreferredSize().height(); | 386 return GetPreferredSize().height(); |
388 } | 387 } |
389 | 388 |
390 void HoverHighlightView::OnMouseEntered(const ui::MouseEvent& event) { | 389 void HoverHighlightView::OnMouseEntered(const ui::MouseEvent& event) { |
391 SetHoverHighlight(true); | 390 SetHoverHighlight(true); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { | 427 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { |
429 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); | 428 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); |
430 } | 429 } |
431 | 430 |
432 void HoverHighlightView::OnFocus() { | 431 void HoverHighlightView::OnFocus() { |
433 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); | 432 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); |
434 ActionableView::OnFocus(); | 433 ActionableView::OnFocus(); |
435 } | 434 } |
436 | 435 |
437 } // namespace ash | 436 } // namespace ash |
OLD | NEW |