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/system/tray/fixed_sized_image_view.h" | 7 #include "ash/system/tray/fixed_sized_image_view.h" |
8 #include "ash/system/tray/tray_constants.h" | 8 #include "ash/system/tray/tray_constants.h" |
9 #include "ash/system/tray/tray_views.h" | 9 #include "ash/system/tray/tray_views.h" |
10 #include "ash/system/tray/view_click_listener.h" | 10 #include "ash/system/tray/view_click_listener.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 return true; | 131 return true; |
132 } | 132 } |
133 | 133 |
134 gfx::Size HoverHighlightView::GetPreferredSize() { | 134 gfx::Size HoverHighlightView::GetPreferredSize() { |
135 gfx::Size size = ActionableView::GetPreferredSize(); | 135 gfx::Size size = ActionableView::GetPreferredSize(); |
136 if (!expandable_ || size.height() < kTrayPopupItemHeight) | 136 if (!expandable_ || size.height() < kTrayPopupItemHeight) |
137 size.set_height(kTrayPopupItemHeight); | 137 size.set_height(kTrayPopupItemHeight); |
138 return size; | 138 return size; |
139 } | 139 } |
140 | 140 |
| 141 int HoverHighlightView::GetHeightForWidth(int width) { |
| 142 return GetPreferredSize().height(); |
| 143 } |
| 144 |
141 void HoverHighlightView::OnMouseEntered(const ui::MouseEvent& event) { | 145 void HoverHighlightView::OnMouseEntered(const ui::MouseEvent& event) { |
142 hover_ = true; | 146 hover_ = true; |
143 if (text_highlight_color_ && text_label_) | 147 if (text_highlight_color_ && text_label_) |
144 text_label_->SetEnabledColor(text_highlight_color_); | 148 text_label_->SetEnabledColor(text_highlight_color_); |
145 SchedulePaint(); | 149 SchedulePaint(); |
146 } | 150 } |
147 | 151 |
148 void HoverHighlightView::OnMouseExited(const ui::MouseEvent& event) { | 152 void HoverHighlightView::OnMouseExited(const ui::MouseEvent& event) { |
149 hover_ = false; | 153 hover_ = false; |
150 if (text_default_color_ && text_label_) | 154 if (text_default_color_ && text_label_) |
(...skipping 10 matching lines...) Expand all Loading... |
161 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); | 165 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); |
162 } | 166 } |
163 | 167 |
164 void HoverHighlightView::OnFocus() { | 168 void HoverHighlightView::OnFocus() { |
165 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); | 169 ScrollRectToVisible(gfx::Rect(gfx::Point(), size())); |
166 ActionableView::OnFocus(); | 170 ActionableView::OnFocus(); |
167 } | 171 } |
168 | 172 |
169 } // namespace internal | 173 } // namespace internal |
170 } // namespace ash | 174 } // namespace ash |
OLD | NEW |