| Index: chrome/browser/ui/views/location_bar/location_icon_view.cc
|
| diff --git a/chrome/browser/ui/views/location_bar/location_icon_view.cc b/chrome/browser/ui/views/location_bar/location_icon_view.cc
|
| index d388e2fa9b8f2eb769d3cfd2b20393d15a02ba67..b2f7ea56a163c70d78f9c99b222881dfbd190ab3 100644
|
| --- a/chrome/browser/ui/views/location_bar/location_icon_view.cc
|
| +++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc
|
| @@ -13,6 +13,7 @@
|
| #include "components/omnibox/browser/omnibox_edit_model.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| +#include "ui/views/animation/ink_drop_impl.h"
|
| #include "ui/views/controls/label.h"
|
|
|
| using content::WebContents;
|
| @@ -20,10 +21,10 @@ using content::WebContents;
|
| LocationIconView::LocationIconView(const gfx::FontList& font_list,
|
| LocationBarView* location_bar)
|
| : IconLabelBubbleView(font_list, true),
|
| - suppress_mouse_released_action_(false),
|
| location_bar_(location_bar),
|
| animation_(this) {
|
| set_id(VIEW_ID_LOCATION_ICON);
|
| + SetInkDropMode(InkDropMode::ON);
|
|
|
| #if defined(OS_MACOSX)
|
| SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
|
| @@ -37,6 +38,10 @@ LocationIconView::LocationIconView(const gfx::FontList& font_list,
|
| LocationIconView::~LocationIconView() {
|
| }
|
|
|
| +bool LocationIconView::CanClick() const {
|
| + return !location_bar_->GetOmniboxView()->IsEditingOrEmpty();
|
| +}
|
| +
|
| gfx::Size LocationIconView::GetMinimumSize() const {
|
| return GetMinimumSizeForPreferredSize(GetPreferredSize());
|
| }
|
| @@ -53,9 +58,7 @@ bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) {
|
| model->PasteAndGo(text);
|
| }
|
|
|
| - suppress_mouse_released_action_ =
|
| - WebsiteSettingsPopupView::GetShownPopupType() !=
|
| - WebsiteSettingsPopupView::POPUP_NONE;
|
| + IconLabelBubbleView::OnMousePressed(event);
|
| return true;
|
| }
|
|
|
| @@ -68,21 +71,18 @@ void LocationIconView::OnMouseReleased(const ui::MouseEvent& event) {
|
| if (event.IsOnlyMiddleMouseButton())
|
| return;
|
|
|
| - // If this is the second click on this view then the bubble was showing on
|
| - // the mouse pressed event and is hidden now. Prevent the bubble from
|
| - // reshowing by doing nothing here.
|
| - if (suppress_mouse_released_action_) {
|
| - suppress_mouse_released_action_ = false;
|
| - return;
|
| - }
|
| -
|
| - OnClickOrTap(event);
|
| + IconLabelBubbleView::OnMouseReleased(event);
|
| }
|
|
|
| void LocationIconView::OnGestureEvent(ui::GestureEvent* event) {
|
| if (event->type() != ui::ET_GESTURE_TAP)
|
| return;
|
| - OnClickOrTap(*event);
|
| +
|
| + if (location_bar_->GetOmniboxView()->IsEditingOrEmpty() &&
|
| + HitTestPoint(event->location())) {
|
| + OnActivate(*event);
|
| + }
|
| +
|
| event->SetHandled();
|
| }
|
|
|
| @@ -110,6 +110,11 @@ void LocationIconView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
|
| node_data->role = ui::AX_ROLE_POP_UP_BUTTON;
|
| }
|
|
|
| +bool LocationIconView::IsBubbleShown() const {
|
| + return WebsiteSettingsPopupView::GetShownPopupType() !=
|
| + WebsiteSettingsPopupView::POPUP_NONE;
|
| +}
|
| +
|
| gfx::Size LocationIconView::GetMinimumSizeForLabelText(
|
| const base::string16& text) const {
|
| views::Label label(text, font_list());
|
| @@ -139,11 +144,6 @@ void LocationIconView::AnimationProgressed(const gfx::Animation*) {
|
| location_bar_->SchedulePaint();
|
| }
|
|
|
| -void LocationIconView::ProcessLocatedEvent(const ui::LocatedEvent& event) {
|
| - if (HitTestPoint(event.location()))
|
| - OnActivate(event);
|
| -}
|
| -
|
| gfx::Size LocationIconView::GetMinimumSizeForPreferredSize(
|
| gfx::Size size) const {
|
| const int kMinCharacters = 10;
|
| @@ -151,11 +151,3 @@ gfx::Size LocationIconView::GetMinimumSizeForPreferredSize(
|
| GetSizeForLabelWidth(font_list().GetExpectedTextWidth(kMinCharacters)));
|
| return size;
|
| }
|
| -
|
| -void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) {
|
| - // Do not show page info if the user has been editing the location bar or the
|
| - // location bar is at the NTP.
|
| - if (location_bar_->GetOmniboxView()->IsEditingOrEmpty())
|
| - return;
|
| - ProcessLocatedEvent(event);
|
| -}
|
|
|