| Index: chrome/browser/ui/views/download/download_item_view.h
|
| diff --git a/chrome/browser/ui/views/download/download_item_view.h b/chrome/browser/ui/views/download/download_item_view.h
|
| index 1b28c4f5d94c4a9095fbee6a7deb203b165078ee..7b16d2c2bb6fe813e5ac652d038c1f4d8760c9f0 100644
|
| --- a/chrome/browser/ui/views/download/download_item_view.h
|
| +++ b/chrome/browser/ui/views/download/download_item_view.h
|
| @@ -34,7 +34,8 @@
|
| #include "ui/gfx/font_list.h"
|
| #include "ui/views/animation/ink_drop_host_view.h"
|
| #include "ui/views/context_menu_controller.h"
|
| -#include "ui/views/controls/button/vector_icon_button_delegate.h"
|
| +#include "ui/views/controls/button/button.h"
|
| +#include "ui/views/controls/button/vector_icon_image_updater.h"
|
|
|
| class DownloadShelfView;
|
| class DownloadShelfContextMenuView;
|
| @@ -54,6 +55,7 @@ class ThemeProvider;
|
| }
|
|
|
| namespace views {
|
| +class ImageButton;
|
| class Label;
|
| class MdTextButton;
|
| }
|
| @@ -61,7 +63,7 @@ class MdTextButton;
|
| // Represents a single download item on the download shelf. Encompasses an icon,
|
| // text, malicious download warnings, etc.
|
| class DownloadItemView : public views::InkDropHostView,
|
| - public views::VectorIconButtonDelegate,
|
| + public views::ButtonListener,
|
| public views::ContextMenuController,
|
| public content::DownloadItem::Observer,
|
| public gfx::AnimationDelegate {
|
| @@ -77,7 +79,7 @@ class DownloadItemView : public views::InkDropHostView,
|
| // Returns the base color for text on this download item, based on |theme|.
|
| static SkColor GetTextColorForThemeProvider(const ui::ThemeProvider* theme);
|
|
|
| - // IconManager::Client interface.
|
| + // IconManager::Client:
|
| void OnExtractIconComplete(gfx::Image* icon);
|
|
|
| // Returns the DownloadItem model object belonging to this item.
|
| @@ -89,12 +91,12 @@ class DownloadItemView : public views::InkDropHostView,
|
| void MaybeSubmitDownloadToFeedbackService(
|
| DownloadCommands::Command download_command);
|
|
|
| - // DownloadItem::Observer methods
|
| + // DownloadItem::Observer:
|
| void OnDownloadUpdated(content::DownloadItem* download) override;
|
| void OnDownloadOpened(content::DownloadItem* download) override;
|
| void OnDownloadDestroyed(content::DownloadItem* download) override;
|
|
|
| - // Overridden from views::View:
|
| + // views::View:
|
| void Layout() override;
|
| gfx::Size GetPreferredSize() const override;
|
| bool OnMousePressed(const ui::MouseEvent& event) override;
|
| @@ -107,30 +109,29 @@ class DownloadItemView : public views::InkDropHostView,
|
| void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
|
| void OnThemeChanged() override;
|
|
|
| - // Overridden from view::InkDropHostView:
|
| + // view::InkDropHostView:
|
| void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
|
| std::unique_ptr<views::InkDrop> CreateInkDrop() override;
|
| std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
|
| std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
|
| const override;
|
|
|
| - // Overridden from ui::EventHandler:
|
| + // ui::EventHandler:
|
| void OnGestureEvent(ui::GestureEvent* event) override;
|
|
|
| - // Overridden from views::ContextMenuController.
|
| + // views::ContextMenuController:
|
| void ShowContextMenuForView(View* source,
|
| const gfx::Point& point,
|
| ui::MenuSourceType source_type) override;
|
|
|
| - // VectorIconButtonDelegate implementation.
|
| + // views::ButtonListener:
|
| void ButtonPressed(views::Button* sender, const ui::Event& event) override;
|
| - SkColor GetVectorIconBaseColor() const override;
|
|
|
| - // gfx::AnimationDelegate implementation.
|
| + // gfx::AnimationDelegate:
|
| void AnimationProgressed(const gfx::Animation* animation) override;
|
|
|
| protected:
|
| - // Overridden from views::View:
|
| + // views::View:
|
| void OnPaint(gfx::Canvas* canvas) override;
|
| void OnFocus() override;
|
| void OnBlur() override;
|
| @@ -139,6 +140,19 @@ class DownloadItemView : public views::InkDropHostView,
|
| FRIEND_TEST_ALL_PREFIXES(DownloadItemViewDangerousDownloadLabelTest,
|
| AdjustTextAndGetSize);
|
|
|
| + class DropDownButtonImageUpdater : public views::VectorIconImageUpdater {
|
| + public:
|
| + DropDownButtonImageUpdater(const gfx::VectorIcon& icon,
|
| + const DownloadItemView* parent);
|
| +
|
| + protected:
|
| + // views::VectorIconImageUpdater:
|
| + SkColor GetVectorIconColor() const override;
|
| +
|
| + private:
|
| + const DownloadItemView* parent_;
|
| + };
|
| +
|
| enum State { NORMAL = 0, HOT, PUSHED };
|
| class DropDownButton;
|
|
|
| @@ -305,7 +319,7 @@ class DownloadItemView : public views::InkDropHostView,
|
| views::MdTextButton* discard_button_;
|
|
|
| // The drop down button.
|
| - DropDownButton* dropdown_button_;
|
| + views::ImageButton* dropdown_button_;
|
|
|
| // Dangerous mode label.
|
| views::Label* dangerous_download_label_;
|
| @@ -337,6 +351,9 @@ class DownloadItemView : public views::InkDropHostView,
|
| // and the user's decisions about it.
|
| std::unique_ptr<extensions::ExperienceSamplingEvent> sampling_event_;
|
|
|
| + // TODO: finish comment. This class is not the owner.
|
| + DropDownButtonImageUpdater* button_image_updater_;
|
| +
|
| // Method factory used to delay reenabling of the item when opening the
|
| // downloaded file.
|
| base::WeakPtrFactory<DownloadItemView> weak_ptr_factory_;
|
|
|