OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/ui/views/location_bar/ev_bubble_view.h" | 5 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" |
6 | 6 |
7 namespace { | |
8 | |
9 // Set a minimum size for elided EV bubbles 150 px. | |
Peter Kasting
2012/12/21 19:17:01
Nit: Grammar
beaudoin
2013/01/03 03:30:45
Done.
| |
10 static const int kMinBubbleWidth = 150; | |
Peter Kasting
2012/12/21 19:17:01
Nit: Just declare this in the function where you u
beaudoin
2013/01/03 03:30:45
Done.
| |
11 | |
12 } // namespace | |
13 | |
7 EVBubbleView::EVBubbleView(const int background_images[], | 14 EVBubbleView::EVBubbleView(const int background_images[], |
8 int contained_image, | 15 int contained_image, |
9 SkColor color, | 16 SkColor color, |
10 LocationBarView* location_bar) | 17 LocationBarView* location_bar) |
11 : IconLabelBubbleView(background_images, contained_image, color), | 18 : IconLabelBubbleView(background_images, contained_image, color), |
12 ALLOW_THIS_IN_INITIALIZER_LIST(page_info_helper_(this, location_bar)) { | 19 ALLOW_THIS_IN_INITIALIZER_LIST(page_info_helper_(this, location_bar)) { |
13 SetElideInMiddle(true); | 20 SetElideInMiddle(true); |
14 } | 21 } |
15 | 22 |
16 EVBubbleView::~EVBubbleView() { | 23 EVBubbleView::~EVBubbleView() { |
17 } | 24 } |
18 | 25 |
26 gfx::Size EVBubbleView::GetMinimumSize() { | |
27 gfx::Size minimum(GetPreferredSize()); | |
28 minimum.set_width(std::min(kMinBubbleWidth, minimum.width())); | |
29 return minimum; | |
30 } | |
31 | |
19 bool EVBubbleView::OnMousePressed(const ui::MouseEvent& event) { | 32 bool EVBubbleView::OnMousePressed(const ui::MouseEvent& event) { |
20 // We want to show the dialog on mouse release; that is the standard behavior | 33 // We want to show the dialog on mouse release; that is the standard behavior |
21 // for buttons. | 34 // for buttons. |
22 return true; | 35 return true; |
23 } | 36 } |
24 | 37 |
25 void EVBubbleView::OnMouseReleased(const ui::MouseEvent& event) { | 38 void EVBubbleView::OnMouseReleased(const ui::MouseEvent& event) { |
26 page_info_helper_.ProcessEvent(event); | 39 page_info_helper_.ProcessEvent(event); |
27 } | 40 } |
28 | 41 |
29 void EVBubbleView::OnGestureEvent(ui::GestureEvent* event) { | 42 void EVBubbleView::OnGestureEvent(ui::GestureEvent* event) { |
30 if (event->type() == ui::ET_GESTURE_TAP) { | 43 if (event->type() == ui::ET_GESTURE_TAP) { |
31 page_info_helper_.ProcessEvent(*event); | 44 page_info_helper_.ProcessEvent(*event); |
32 event->SetHandled(); | 45 event->SetHandled(); |
33 } | 46 } |
34 } | 47 } |
OLD | NEW |