Index: ui/message_center/views/notification_header_view.cc |
diff --git a/ui/message_center/views/notification_header_view.cc b/ui/message_center/views/notification_header_view.cc |
index 091160954390f8a727815ba7911e92d188d3258f..7a4fa5d9d8a4b62f7af2b273010ba832839a332a 100644 |
--- a/ui/message_center/views/notification_header_view.cc |
+++ b/ui/message_center/views/notification_header_view.cc |
@@ -14,6 +14,9 @@ |
#include "ui/message_center/vector_icons.h" |
#include "ui/message_center/views/padded_button.h" |
#include "ui/strings/grit/ui_strings.h" |
+#include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
+#include "ui/views/animation/ink_drop_highlight.h" |
+#include "ui/views/animation/ink_drop_impl.h" |
#include "ui/views/controls/button/image_button.h" |
#include "ui/views/controls/image_view.h" |
#include "ui/views/controls/label.h" |
@@ -33,10 +36,24 @@ constexpr int kAppInfoConatainerTopPadding = 12; |
// Bullet character. The divider symbol between different parts of the header. |
constexpr base::char16 kNotificationHeaderDividerSymbol = 0x2022; |
+// Base ink drop color of action buttons. |
+const SkColor kInkDropBaseColor = SkColorSetRGB(0x0, 0x0, 0x0); |
+// Ripple ink drop opacity of action buttons. |
+constexpr float kInkDropRippleVisibleOpacity = 0.08f; |
+// Highlight (hover) ink drop opacity of action buttons. |
+constexpr float kInkDropHighlightVisibleOpacity = 0.08f; |
+ |
} // namespace |
NotificationHeaderView::NotificationHeaderView(views::ButtonListener* listener) |
: views::CustomButton(listener) { |
+ SetInkDropMode(InkDropMode::ON); |
+ set_has_ink_drop_action_on_click(true); |
+ set_animate_on_state_change(true); |
+ set_notify_enter_exit_on_child(true); |
+ set_ink_drop_base_color(kInkDropBaseColor); |
+ set_ink_drop_visible_opacity(kInkDropRippleVisibleOpacity); |
+ |
views::BoxLayout* layout = new views::BoxLayout( |
views::BoxLayout::kHorizontal, kHeaderPadding, kHeaderHorizontalSpacing); |
layout->set_cross_axis_alignment( |
@@ -184,6 +201,30 @@ bool NotificationHeaderView::IsCloseButtonEnabled() { |
return close_button_enabled_; |
} |
+std::unique_ptr<views::InkDrop> NotificationHeaderView::CreateInkDrop() { |
+ auto ink_drop = base::MakeUnique<views::InkDropImpl>(this, size()); |
+ ink_drop->SetAutoHighlightMode( |
+ views::InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE); |
+ ink_drop->SetShowHighlightOnHover(false); |
+ return ink_drop; |
+} |
+ |
+std::unique_ptr<views::InkDropRipple> |
+NotificationHeaderView::CreateInkDropRipple() const { |
+ return base::MakeUnique<views::FloodFillInkDropRipple>( |
+ size(), GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(), |
+ ink_drop_visible_opacity()); |
+} |
+ |
+std::unique_ptr<views::InkDropHighlight> |
+NotificationHeaderView::CreateInkDropHighlight() const { |
+ auto highlight = base::MakeUnique<views::InkDropHighlight>( |
+ size(), kInkDropSmallCornerRadius, |
+ gfx::RectF(GetLocalBounds()).CenterPoint(), GetInkDropBaseColor()); |
+ highlight->set_visible_opacity(kInkDropHighlightVisibleOpacity); |
+ return highlight; |
+} |
+ |
void NotificationHeaderView::UpdateControlButtonsVisibility() { |
settings_button_->SetVisible(settings_button_enabled_ && |
is_control_buttons_visible_); |