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

Unified Diff: chrome/browser/ui/views/location_bar/icon_label_bubble_view.h

Issue 2720183002: [Views] Update ink drop for omnibox icons (Closed)
Patch Set: Update the behavior Created 3 years, 9 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/icon_label_bubble_view.h
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
index 7b5d37e0dfeb9b652ca2ef4b191108c954cc60d9..24308a60739d113cbf671f37017b5eab7b6f03ea 100644
--- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
+++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
@@ -13,22 +13,25 @@
#include "ui/gfx/geometry/size.h"
#include "ui/views/animation/ink_drop_host_view.h"
#include "ui/views/controls/label.h"
+#include "ui/views/widget/widget_observer.h"
+
+class SeparatorView;
bruthig 2017/03/08 18:58:24 I will let OWNER's confirm/correct me on this but
spqchan 2017/03/14 00:07:52 Done.
namespace gfx {
-class Canvas;
class FontList;
class ImageSkia;
}
namespace views {
class ImageView;
-class Label;
+class InkDropContainerView;
}
// View used to draw a bubble, containing an icon and a label. We use this as a
// base for the classes that handle the location icon (including the EV bubble),
// tab-to-search UI, and content settings.
-class IconLabelBubbleView : public views::InkDropHostView {
+class IconLabelBubbleView : public views::InkDropHostView,
+ public views::WidgetObserver {
public:
static constexpr int kTrailingPaddingPreMd = 2;
@@ -67,6 +70,11 @@ class IconLabelBubbleView : public views::InkDropHostView {
// Returns true when animation is in progress and is shrinking.
virtual bool IsShrinking() const;
+ // Returns true if ink drop is enabled. Subclasses are expected to override
+ // this if they want to have an inkdrop effect. Otherwise, it's false by
+ // default.
+ virtual bool IsInkDropEnabled() const;
bruthig 2017/03/08 18:58:24 Would InkDropHostView::SetInkDropMode() be a suffi
spqchan 2017/03/14 00:07:52 Not quite, IsInkDropEnabled() is used in LocationI
+
// The view has been activated by a user gesture such as spacebar. Returns
// true if some handling was performed.
virtual bool OnActivate(const ui::Event& event);
@@ -74,15 +82,24 @@ class IconLabelBubbleView : public views::InkDropHostView {
// views::InkDropHostView:
gfx::Size GetPreferredSize() const override;
void Layout() override;
+ bool OnMousePressed(const ui::MouseEvent& event) override;
+ void OnMouseReleased(const ui::MouseEvent& event) override;
bool OnKeyPressed(const ui::KeyEvent& event) override;
bool OnKeyReleased(const ui::KeyEvent& event) override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override;
void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override;
+ std::unique_ptr<views::InkDrop> CreateInkDrop() override;
std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
const override;
+ std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
SkColor GetInkDropBaseColor() const override;
+ void InkDropAnimationStarted() override;
+
+ // views::WidgetObserver:
+ void OnWidgetDestroying(views::Widget* widget) override;
+ void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override;
const gfx::FontList& font_list() const { return label_->font_list(); }
@@ -91,6 +108,8 @@ class IconLabelBubbleView : public views::InkDropHostView {
gfx::Size GetSizeForLabelWidth(int label_width) const;
private:
+ friend SeparatorView;
+
// Amount of padding from the leading edge of the view to the leading edge of
// the image, and from the trailing edge of the label (or image, if the label
// is invisible) to the trailing edge of the view.
@@ -106,11 +125,12 @@ class IconLabelBubbleView : public views::InkDropHostView {
// views::View:
const char* GetClassName() const override;
- void OnPaint(gfx::Canvas* canvas) override;
// The contents of the bubble.
views::ImageView* image_;
views::Label* label_;
+ views::InkDropContainerView* ink_drop_container_;
+ std::unique_ptr<SeparatorView> separator_view_;
// The padding of the element that will be displayed after |this|. This value
// is relevant for calculating the amount of space to reserve after the

Powered by Google App Engine
This is Rietveld 408576698