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

Unified Diff: chrome/browser/ui/views/download/download_item_view_md.cc

Issue 2041033002: Moved ButtonInkDropDelegate logic into InkDropHostView and deleted InkDropDelegates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed merge conflict in custom_button.cc Created 4 years, 6 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/download/download_item_view_md.cc
diff --git a/chrome/browser/ui/views/download/download_item_view_md.cc b/chrome/browser/ui/views/download/download_item_view_md.cc
index 7f2fbbf024f7787189c70539d3a8d8d2299e355b..6cfa4c72f00b05c6d83e2c6dd877a61da613fe18 100644
--- a/chrome/browser/ui/views/download/download_item_view_md.cc
+++ b/chrome/browser/ui/views/download/download_item_view_md.cc
@@ -58,7 +58,6 @@
#include "ui/gfx/text_elider.h"
#include "ui/gfx/text_utils.h"
#include "ui/gfx/vector_icons_public.h"
-#include "ui/views/animation/button_ink_drop_delegate.h"
#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/border.h"
@@ -151,6 +150,22 @@ class SeparatorBorder : public views::Border {
} // namespace
+// Allows the DownloadItemViewMd to control the InkDrop on the drop down button.
+class DownloadItemViewMd::DropDownButton : public BarControlButton {
+ public:
+ explicit DropDownButton(views::ButtonListener* listener)
+ : BarControlButton(listener) {}
+ ~DropDownButton() override {}
+
+ // Promoted visibility to public.
+ void AnimateInkDrop(views::InkDropState state) {
+ BarControlButton::AnimateInkDrop(state);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DropDownButton);
+};
+
DownloadItemViewMd::DownloadItemViewMd(DownloadItem* download_item,
DownloadShelfView* parent)
: shelf_(parent),
@@ -160,17 +175,16 @@ DownloadItemViewMd::DownloadItemViewMd(DownloadItem* download_item,
dragging_(false),
starting_drag_(false),
model_(download_item),
- button_ink_drop_delegate_(new views::ButtonInkDropDelegate(this, this)),
save_button_(nullptr),
discard_button_(nullptr),
- dropdown_button_(new BarControlButton(this)),
+ dropdown_button_(new DropDownButton(this)),
dangerous_download_label_(nullptr),
dangerous_download_label_sized_(false),
disabled_while_opening_(false),
creation_time_(base::Time::Now()),
time_download_warning_shown_(base::Time()),
weak_ptr_factory_(this) {
- set_ink_drop_delegate(base::WrapUnique(button_ink_drop_delegate_));
+ SetHasInkDrop(true);
DCHECK(download());
DCHECK(ui::MaterialDesignController::IsModeMaterial());
download()->AddObserver(this);
@@ -393,7 +407,7 @@ bool DownloadItemViewMd::OnMouseDragged(const ui::MouseEvent& event) {
if (!starting_drag_) {
starting_drag_ = true;
drag_start_point_ = event.location();
- button_ink_drop_delegate_->OnAction(views::InkDropState::HIDDEN);
+ AnimateInkDrop(views::InkDropState::HIDDEN);
}
if (dragging_) {
if (download()->GetState() == DownloadItem::COMPLETE) {
@@ -433,8 +447,6 @@ bool DownloadItemViewMd::OnKeyPressed(const ui::KeyEvent& event) {
if (event.key_code() == ui::VKEY_SPACE ||
event.key_code() == ui::VKEY_RETURN) {
- button_ink_drop_delegate_->set_last_ink_drop_location(
- GetLocalBounds().CenterPoint());
// OpenDownload may delete this, so don't add any code after this line.
OpenDownload();
return true;
@@ -478,7 +490,7 @@ void DownloadItemViewMd::AddInkDropLayer(ui::Layer* ink_drop_layer) {
std::unique_ptr<views::InkDropRipple> DownloadItemViewMd::CreateInkDropRipple()
const {
return base::WrapUnique(new views::FloodFillInkDropRipple(
- GetLocalBounds(), button_ink_drop_delegate_->last_ink_drop_location(),
+ GetLocalBounds(), GetLocalBounds().CenterPoint(),
color_utils::DeriveDefaultIconColor(GetTextColor())));
}
@@ -741,7 +753,7 @@ void DownloadItemViewMd::OpenDownload() {
base::Time::Now() - creation_time_);
UpdateAccessibleName();
- button_ink_drop_delegate_->OnAction(views::InkDropState::ACTION_TRIGGERED);
+ AnimateInkDrop(views::InkDropState::ACTION_TRIGGERED);
// Calling download()->OpenDownload may delete this, so this must be
// the last thing we do.
@@ -841,8 +853,7 @@ void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event,
if (!active_event)
return;
- button_ink_drop_delegate_->set_last_ink_drop_location(event.location());
- button_ink_drop_delegate_->OnAction(views::InkDropState::ACTION_PENDING);
+ AnimateInkDrop(views::InkDropState::ACTION_PENDING);
}
void DownloadItemViewMd::HandleClickEvent(const ui::LocatedEvent& event,
@@ -870,9 +881,9 @@ void DownloadItemViewMd::SetDropdownState(State new_state) {
: gfx::VectorIconId::FIND_PREV,
base::Bind(&DownloadItemViewMd::GetTextColor, base::Unretained(this)));
if (new_state != dropdown_state_) {
- dropdown_button_->ink_drop_delegate()->OnAction(
- new_state == PUSHED ? views::InkDropState::ACTIVATED
- : views::InkDropState::DEACTIVATED);
+ dropdown_button_->AnimateInkDrop(new_state == PUSHED
+ ? views::InkDropState::ACTIVATED
+ : views::InkDropState::DEACTIVATED);
}
dropdown_button_->OnThemeChanged();
dropdown_state_ = new_state;
« no previous file with comments | « chrome/browser/ui/views/download/download_item_view_md.h ('k') | chrome/browser/ui/views/location_bar/bubble_icon_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698