Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3853)

Unified Diff: chrome/browser/ui/views/location_bar/location_icon_view.cc

Issue 2720183002: [Views] Update ink drop for omnibox icons (Closed)
Patch Set: Removed CanProcessEventsWithinSubtree Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 d54f57d58e61bfdd4877560a6e5a13e4390ead4a..1ada6ed7f9652ae0a8fb6efe54c03a7ef9f4aa77 100644
--- a/chrome/browser/ui/views/location_bar/location_icon_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc
@@ -21,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);
@@ -54,36 +54,13 @@ bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) {
model->PasteAndGo(text);
}
- suppress_mouse_released_action_ = PageInfoBubbleView::GetShownBubbleType() !=
- PageInfoBubbleView::BUBBLE_NONE;
+ IconLabelBubbleView::OnMousePressed(event);
return true;
}
bool LocationIconView::OnMouseDragged(const ui::MouseEvent& event) {
location_bar_->GetOmniboxView()->CloseOmniboxPopup();
- return false;
-}
-
-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);
-}
-
-void LocationIconView::OnGestureEvent(ui::GestureEvent* event) {
- if (event->type() != ui::ET_GESTURE_TAP)
- return;
- OnClickOrTap(*event);
- event->SetHandled();
+ return IconLabelBubbleView::OnMouseDragged(event);
}
bool LocationIconView::GetTooltipText(const gfx::Point& p,
@@ -97,7 +74,7 @@ SkColor LocationIconView::GetTextColor() const {
return location_bar_->GetColor(LocationBarView::SECURITY_CHIP_TEXT);
}
-bool LocationIconView::OnActivate(const ui::Event& event) {
+bool LocationIconView::ShowBubble(const ui::Event& event) {
WebContents* contents = location_bar_->GetWebContents();
if (!contents)
return false;
@@ -110,6 +87,11 @@ void LocationIconView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->role = ui::AX_ROLE_POP_UP_BUTTON;
}
+bool LocationIconView::IsBubbleShowing() const {
+ return PageInfoBubbleView::GetShownBubbleType() !=
+ PageInfoBubbleView::BUBBLE_NONE;
+}
+
gfx::Size LocationIconView::GetMinimumSizeForLabelText(
const base::string16& text) const {
views::Label label(text, {font_list()});
@@ -130,6 +112,20 @@ void LocationIconView::SetTextVisibility(bool should_show,
OnNativeThemeChanged(GetNativeTheme());
}
+bool LocationIconView::IsTriggerableEvent(const ui::Event& event) {
+ if (location_bar_->GetOmniboxView()->IsEditingOrEmpty())
+ return false;
+
+ if (event.IsMouseEvent()) {
+ if (event.AsMouseEvent()->IsOnlyMiddleMouseButton())
+ return false;
+ } else if (event.IsGestureEvent() && event.type() != ui::ET_GESTURE_TAP) {
+ return false;
+ }
+
+ return IconLabelBubbleView::IsTriggerableEvent(event);
+}
+
double LocationIconView::WidthMultiplier() const {
return animation_.GetCurrentValue();
}
@@ -139,11 +135,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 +142,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);
-}
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_icon_view.h ('k') | chrome/browser/ui/views/page_info/page_info_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698