Index: chrome/browser/ui/views/location_bar/content_setting_image_view.cc |
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc |
index 6ea7d207c236b6a8cce42dd77831c9749266633d..b0a18045ac85a0c9ce3547785459a5092ada9670 100644 |
--- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc |
+++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc |
@@ -41,8 +41,7 @@ ContentSettingImageView::ContentSettingImageView( |
slide_animator_(this), |
pause_animation_(false), |
pause_animation_state_(0.0), |
- bubble_view_(nullptr), |
- suppress_mouse_released_action_(false) { |
+ bubble_view_(nullptr) { |
set_next_element_interior_padding(LocationBarView::kIconInteriorPadding); |
SetInkDropMode(InkDropMode::ON); |
SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); |
@@ -81,8 +80,8 @@ void ContentSettingImageView::Update(content::WebContents* web_contents) { |
// the user. If this becomes a problem, we could design some sort of queueing |
// mechanism to show one after the other, but it doesn't seem important now. |
int string_id = content_setting_image_model_->explanatory_string_id(); |
+ AnimateInkDrop(views::InkDropState::HIDDEN, nullptr /* event */); |
if (string_id && !label()->visible()) { |
- AnimateInkDrop(views::InkDropState::HIDDEN, nullptr /* event */); |
SetLabel(l10n_util::GetStringUTF16(string_id)); |
label()->SetVisible(true); |
slide_animator_.Show(); |
@@ -99,40 +98,7 @@ void ContentSettingImageView::OnBoundsChanged( |
const gfx::Rect& previous_bounds) { |
if (bubble_view_) |
bubble_view_->OnAnchorBoundsChanged(); |
-} |
- |
-bool ContentSettingImageView::OnMousePressed(const ui::MouseEvent& event) { |
- // If the bubble is showing then don't reshow it when the mouse is released. |
- suppress_mouse_released_action_ = bubble_view_ != nullptr; |
- if (!suppress_mouse_released_action_ && !label()->visible()) |
- AnimateInkDrop(views::InkDropState::ACTION_PENDING, &event); |
- |
- // We want to show the bubble on mouse release; that is the standard behavior |
- // for buttons. |
- return true; |
-} |
- |
-void ContentSettingImageView::OnMouseReleased(const ui::MouseEvent& event) { |
- // 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; |
- } |
- const bool activated = HitTestPoint(event.location()); |
- if (!label()->visible() && !activated) |
- AnimateInkDrop(views::InkDropState::HIDDEN, &event); |
- if (activated) |
- OnActivate(event); |
-} |
- |
-void ContentSettingImageView::OnGestureEvent(ui::GestureEvent* event) { |
- if (event->type() == ui::ET_GESTURE_TAP) |
- OnActivate(*event); |
- if ((event->type() == ui::ET_GESTURE_TAP) || |
- (event->type() == ui::ET_GESTURE_TAP_DOWN)) |
- event->SetHandled(); |
+ IconLabelBubbleView::OnBoundsChanged(previous_bounds); |
} |
bool ContentSettingImageView::GetTooltipText(const gfx::Point& p, |
@@ -147,12 +113,6 @@ void ContentSettingImageView::OnNativeThemeChanged( |
IconLabelBubbleView::OnNativeThemeChanged(native_theme); |
} |
-std::unique_ptr<views::InkDrop> ContentSettingImageView::CreateInkDrop() { |
- std::unique_ptr<views::InkDropImpl> ink_drop = CreateDefaultInkDropImpl(); |
- ink_drop->SetShowHighlightOnFocus(true); |
- return std::move(ink_drop); |
-} |
- |
SkColor ContentSettingImageView::GetTextColor() const { |
return GetNativeTheme()->GetSystemColor( |
ui::NativeTheme::kColorId_TextfieldDefaultColor); |
@@ -233,6 +193,20 @@ bool ContentSettingImageView::OnActivate(const ui::Event& event) { |
return true; |
} |
+bool ContentSettingImageView::IsBubbleShown() const { |
+ return bubble_view_ != nullptr; |
+} |
+ |
+// TODO(bruthig): See crbug.com/669253. Since the ink drop highlight currently |
+// cannot handle host resizes, the highlight needs to be disabled when the |
+// animation is running. |
+std::unique_ptr<views::InkDropHighlight> |
+ContentSettingImageView::CreateInkDropHighlight() const { |
+ return slide_animator_.is_animating() |
+ ? nullptr |
bruthig
2017/04/21 15:05:09
CreateInkDropHighlight() overrides shouldn't retur
spqchan
2017/04/27 21:40:06
Done.
|
+ : IconLabelBubbleView::CreateInkDropHighlight(); |
+} |
+ |
void ContentSettingImageView::AnimationEnded(const gfx::Animation* animation) { |
slide_animator_.Reset(); |
if (!pause_animation_) { |
@@ -271,7 +245,7 @@ void ContentSettingImageView::OnWidgetDestroying(views::Widget* widget) { |
void ContentSettingImageView::OnWidgetVisibilityChanged(views::Widget* widget, |
bool visible) { |
// |widget| is a bubble that has just got shown / hidden. |
- if (!visible && !label()->visible()) |
+ if (!visible) |
AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr /* event */); |
} |