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 | 7 |
8 EVBubbleView::EVBubbleView(const int background_images[], | 8 EVBubbleView::EVBubbleView(const int background_images[], |
9 int contained_image, | 9 int contained_image, |
10 const gfx::Font& font, | 10 const gfx::Font& font, |
11 int font_y_offset, | 11 int font_y_offset, |
12 SkColor color, | 12 SkColor color, |
13 LocationBarView* location_bar) | 13 LocationBarView* location_bar) |
14 : IconLabelBubbleView(background_images, contained_image, font, | 14 : IconLabelBubbleView(background_images, contained_image, font, |
15 font_y_offset, color, true), | 15 font_y_offset, color, true), |
16 page_info_helper_(this, location_bar) { | 16 page_info_helper_(this, location_bar) { |
17 } | 17 } |
18 | 18 |
19 EVBubbleView::~EVBubbleView() { | 19 EVBubbleView::~EVBubbleView() { |
20 } | 20 } |
21 | 21 |
22 gfx::Size EVBubbleView::GetMinimumSize() { | 22 gfx::Size EVBubbleView::GetMinimumSize() { |
23 // Height will be ignored by the LocationBarView. | 23 // Height will be ignored by the LocationBarView. |
24 gfx::Size minimum(GetPreferredSize()); | 24 gfx::Size minimum(GetPreferredSize()); |
25 static const int kMinBubbleWidth = 150; | 25 static const int kMinBubbleWidth = 150; |
26 minimum.ClampToMin(gfx::Size(kMinBubbleWidth, 0)); | 26 minimum.SetToMax(gfx::Size(kMinBubbleWidth, 0)); |
27 return minimum; | 27 return minimum; |
28 } | 28 } |
29 | 29 |
30 bool EVBubbleView::OnMousePressed(const ui::MouseEvent& event) { | 30 bool EVBubbleView::OnMousePressed(const ui::MouseEvent& event) { |
31 // We want to show the dialog on mouse release; that is the standard behavior | 31 // We want to show the dialog on mouse release; that is the standard behavior |
32 // for buttons. | 32 // for buttons. |
33 return true; | 33 return true; |
34 } | 34 } |
35 | 35 |
36 void EVBubbleView::OnMouseReleased(const ui::MouseEvent& event) { | 36 void EVBubbleView::OnMouseReleased(const ui::MouseEvent& event) { |
37 page_info_helper_.ProcessEvent(event); | 37 page_info_helper_.ProcessEvent(event); |
38 } | 38 } |
39 | 39 |
40 void EVBubbleView::OnGestureEvent(ui::GestureEvent* event) { | 40 void EVBubbleView::OnGestureEvent(ui::GestureEvent* event) { |
41 if (event->type() == ui::ET_GESTURE_TAP) { | 41 if (event->type() == ui::ET_GESTURE_TAP) { |
42 page_info_helper_.ProcessEvent(*event); | 42 page_info_helper_.ProcessEvent(*event); |
43 event->SetHandled(); | 43 event->SetHandled(); |
44 } | 44 } |
45 } | 45 } |
OLD | NEW |