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