Index: chrome/browser/ui/views/location_bar/ev_bubble_view.cc |
diff --git a/chrome/browser/ui/views/location_bar/ev_bubble_view.cc b/chrome/browser/ui/views/location_bar/ev_bubble_view.cc |
index ad5c27afcdf7db1b339b908ed4d871b0d01db7fd..a1f3a55774c74aa2cedd69ff0004d43333faddce 100644 |
--- a/chrome/browser/ui/views/location_bar/ev_bubble_view.cc |
+++ b/chrome/browser/ui/views/location_bar/ev_bubble_view.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" |
#include "grit/theme_resources.h" |
+#include "ui/views/controls/label.h" |
#include "ui/views/painter.h" |
@@ -25,11 +26,7 @@ EVBubbleView::~EVBubbleView() { |
} |
gfx::Size EVBubbleView::GetMinimumSize() { |
- // Height will be ignored by the LocationBarView. |
- gfx::Size minimum(GetPreferredSize()); |
- static const int kMinBubbleWidth = 150; |
- minimum.SetToMax(gfx::Size(kMinBubbleWidth, 0)); |
- return minimum; |
+ return GetMinimumSizeForPreferredSize(GetPreferredSize()); |
} |
bool EVBubbleView::OnMousePressed(const ui::MouseEvent& event) { |
@@ -48,3 +45,17 @@ void EVBubbleView::OnGestureEvent(ui::GestureEvent* event) { |
event->SetHandled(); |
} |
} |
+ |
+gfx::Size EVBubbleView::GetMinimumSizeForLabelText( |
+ const base::string16& text) const { |
+ views::Label label(text, font_list()); |
+ return GetMinimumSizeForPreferredSize( |
+ GetSizeForLabelWidth(label.GetPreferredSize().width())); |
+} |
+ |
+gfx::Size EVBubbleView::GetMinimumSizeForPreferredSize(gfx::Size size) const { |
+ const int kMinCharacters = 10; |
+ size.SetToMin( |
+ GetSizeForLabelWidth(font_list().GetExpectedTextWidth(kMinCharacters))); |
+ return size; |
+} |