| 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 #include "grit/theme_resources.h" | 6 #include "grit/theme_resources.h" |
| 7 #include "ui/views/painter.h" | 7 #include "ui/views/painter.h" |
| 8 | 8 |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 const int kBackgroundImages[] = IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE); | 11 const int kBackgroundImages[] = IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE); |
| 12 } | 12 } |
| 13 | 13 |
| 14 | 14 |
| 15 EVBubbleView::EVBubbleView(const gfx::FontList& font_list, | 15 EVBubbleView::EVBubbleView(const gfx::FontList& font_list, |
| 16 SkColor text_color, | 16 SkColor text_color, |
| 17 SkColor parent_background_color, | 17 SkColor parent_background_color, |
| 18 LocationBarView* location_bar) | 18 LocationBarView* location_bar) |
| 19 : IconLabelBubbleView(kBackgroundImages, NULL, IDR_OMNIBOX_HTTPS_VALID, | 19 : IconLabelBubbleView(kBackgroundImages, NULL, IDR_OMNIBOX_HTTPS_VALID, |
| 20 font_list, text_color, parent_background_color, true), | 20 font_list, text_color, parent_background_color, true), |
| 21 page_info_helper_(this, location_bar) { | 21 page_info_helper_(this, location_bar) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 EVBubbleView::~EVBubbleView() { | 24 EVBubbleView::~EVBubbleView() { |
| 25 } | 25 } |
| 26 | 26 |
| 27 gfx::Size EVBubbleView::GetMinimumSize() { | 27 gfx::Size EVBubbleView::GetMinimumSize() const { |
| 28 // Height will be ignored by the LocationBarView. | 28 // Height will be ignored by the LocationBarView. |
| 29 gfx::Size minimum(GetPreferredSize()); | 29 gfx::Size minimum(GetPreferredSize()); |
| 30 static const int kMinBubbleWidth = 150; | 30 static const int kMinBubbleWidth = 150; |
| 31 minimum.SetToMax(gfx::Size(kMinBubbleWidth, 0)); | 31 minimum.SetToMax(gfx::Size(kMinBubbleWidth, 0)); |
| 32 return minimum; | 32 return minimum; |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool EVBubbleView::OnMousePressed(const ui::MouseEvent& event) { | 35 bool EVBubbleView::OnMousePressed(const ui::MouseEvent& event) { |
| 36 // We want to show the dialog on mouse release; that is the standard behavior | 36 // We want to show the dialog on mouse release; that is the standard behavior |
| 37 // for buttons. | 37 // for buttons. |
| 38 return true; | 38 return true; |
| 39 } | 39 } |
| 40 | 40 |
| 41 void EVBubbleView::OnMouseReleased(const ui::MouseEvent& event) { | 41 void EVBubbleView::OnMouseReleased(const ui::MouseEvent& event) { |
| 42 page_info_helper_.ProcessEvent(event); | 42 page_info_helper_.ProcessEvent(event); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void EVBubbleView::OnGestureEvent(ui::GestureEvent* event) { | 45 void EVBubbleView::OnGestureEvent(ui::GestureEvent* event) { |
| 46 if (event->type() == ui::ET_GESTURE_TAP) { | 46 if (event->type() == ui::ET_GESTURE_TAP) { |
| 47 page_info_helper_.ProcessEvent(*event); | 47 page_info_helper_.ProcessEvent(*event); |
| 48 event->SetHandled(); | 48 event->SetHandled(); |
| 49 } | 49 } |
| 50 } | 50 } |
| OLD | NEW |