| Index: chrome/browser/ui/views/download/download_item_view.cc
|
| diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
|
| index 77965e3f57245afb1e89dc260bdfb22ebc848814..2bbde33e98e5a9889e7106825f1ce2268d1d5dfe 100644
|
| --- a/chrome/browser/ui/views/download/download_item_view.cc
|
| +++ b/chrome/browser/ui/views/download/download_item_view.cc
|
| @@ -62,8 +62,8 @@
|
| #include "ui/views/animation/ink_drop_highlight.h"
|
| #include "ui/views/animation/ink_drop_impl.h"
|
| #include "ui/views/border.h"
|
| +#include "ui/views/controls/button/image_button.h"
|
| #include "ui/views/controls/button/md_text_button.h"
|
| -#include "ui/views/controls/button/vector_icon_button.h"
|
| #include "ui/views/controls/focusable_border.h"
|
| #include "ui/views/controls/label.h"
|
| #include "ui/views/mouse_constants.h"
|
| @@ -154,22 +154,15 @@ class SeparatorBorder : public views::FocusableBorder {
|
|
|
| } // namespace
|
|
|
| -// Allows the DownloadItemView to control the InkDrop on the drop down button.
|
| -class DownloadItemView::DropDownButton : public views::VectorIconButton {
|
| - public:
|
| - explicit DropDownButton(views::VectorIconButtonDelegate* delegate)
|
| - : views::VectorIconButton(delegate) {}
|
| - ~DropDownButton() override {}
|
| -
|
| - // Promoted visibility to public.
|
| - void AnimateInkDrop(views::InkDropState state) {
|
| - // TODO(bruthig): Plumb in the proper Event.
|
| - views::VectorIconButton::AnimateInkDrop(state, nullptr /* event */);
|
| - }
|
| +DownloadItemView::DropDownButtonImageUpdater::DropDownButtonImageUpdater(
|
| + const gfx::VectorIcon& icon,
|
| + const DownloadItemView* parent)
|
| + : VectorIconImageUpdater(icon), parent_(parent) {}
|
|
|
| - private:
|
| - DISALLOW_COPY_AND_ASSIGN(DropDownButton);
|
| -};
|
| +SkColor DownloadItemView::DropDownButtonImageUpdater::GetVectorIconColor()
|
| + const {
|
| + return parent_->GetTextColor();
|
| +}
|
|
|
| DownloadItemView::DownloadItemView(DownloadItem* download_item,
|
| DownloadShelfView* parent)
|
| @@ -182,7 +175,6 @@ DownloadItemView::DownloadItemView(DownloadItem* download_item,
|
| model_(download_item),
|
| save_button_(nullptr),
|
| discard_button_(nullptr),
|
| - dropdown_button_(new DropDownButton(this)),
|
| dangerous_download_label_(nullptr),
|
| dangerous_download_label_sized_(false),
|
| disabled_while_opening_(false),
|
| @@ -194,8 +186,10 @@ DownloadItemView::DownloadItemView(DownloadItem* download_item,
|
| download()->AddObserver(this);
|
| set_context_menu_controller(this);
|
|
|
| - dropdown_button_->SetBorder(
|
| - views::CreateEmptyBorder(gfx::Insets(kDropdownBorderWidth)));
|
| + button_image_updater_ = new DropDownButtonImageUpdater(kCaretUpIcon, this);
|
| + dropdown_button_ =
|
| + views::CreateImageButtonWithImageUpdater(button_image_updater_, this);
|
| + dropdown_button_->SetPadding(gfx::Insets(kDropdownBorderWidth));
|
| AddChildView(dropdown_button_);
|
|
|
| LoadIcon();
|
| @@ -601,10 +595,6 @@ void DownloadItemView::ButtonPressed(views::Button* sender,
|
| // WARNING: 'this' maybe deleted at this point. Don't access 'this'.
|
| }
|
|
|
| -SkColor DownloadItemView::GetVectorIconBaseColor() const {
|
| - return GetTextColor();
|
| -}
|
| -
|
| void DownloadItemView::AnimationProgressed(const gfx::Animation* animation) {
|
| // We don't care if what animation (body button/drop button/complete),
|
| // is calling back, as they all have to go through the same paint call.
|
| @@ -882,14 +872,15 @@ void DownloadItemView::SetDropdownState(State new_state) {
|
| !dropdown_button_->GetImage(views::CustomButton::STATE_NORMAL).isNull())
|
| return;
|
|
|
| - dropdown_button_->SetIcon(new_state == PUSHED ? kCaretDownIcon
|
| - : kCaretUpIcon);
|
| + button_image_updater_->SetIcon(new_state == PUSHED ? kCaretDownIcon
|
| + : kCaretUpIcon);
|
| if (new_state != dropdown_state_) {
|
| + // TODO(bruthig): Plumb in the proper Event.
|
| dropdown_button_->AnimateInkDrop(new_state == PUSHED
|
| ? views::InkDropState::ACTIVATED
|
| - : views::InkDropState::DEACTIVATED);
|
| + : views::InkDropState::DEACTIVATED,
|
| + nullptr);
|
| }
|
| - dropdown_button_->OnThemeChanged();
|
| dropdown_state_ = new_state;
|
| SchedulePaint();
|
| }
|
|
|