| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // A view that implements one download on the Download shelf. | 5 // A view that implements one download on the Download shelf. |
| 6 // Each DownloadItemViewMd contains an application icon, a text label | 6 // Each DownloadItemViewMd contains an application icon, a text label |
| 7 // indicating the download's file name, a text label indicating the | 7 // indicating the download's file name, a text label indicating the |
| 8 // download's status (such as the number of bytes downloaded so far) | 8 // download's status (such as the number of bytes downloaded so far) |
| 9 // and a button for canceling an in progress download, or opening | 9 // and a button for canceling an in progress download, or opening |
| 10 // the completed download. | 10 // the completed download. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "base/time/time.h" | 26 #include "base/time/time.h" |
| 27 #include "base/timer/timer.h" | 27 #include "base/timer/timer.h" |
| 28 #include "chrome/browser/download/download_item_model.h" | 28 #include "chrome/browser/download/download_item_model.h" |
| 29 #include "chrome/browser/icon_manager.h" | 29 #include "chrome/browser/icon_manager.h" |
| 30 #include "content/public/browser/download_item.h" | 30 #include "content/public/browser/download_item.h" |
| 31 #include "content/public/browser/download_manager.h" | 31 #include "content/public/browser/download_manager.h" |
| 32 #include "ui/gfx/animation/animation_delegate.h" | 32 #include "ui/gfx/animation/animation_delegate.h" |
| 33 #include "ui/gfx/font_list.h" | 33 #include "ui/gfx/font_list.h" |
| 34 #include "ui/views/animation/ink_drop_host_view.h" | 34 #include "ui/views/animation/ink_drop_host_view.h" |
| 35 #include "ui/views/context_menu_controller.h" | 35 #include "ui/views/context_menu_controller.h" |
| 36 #include "ui/views/controls/button/button.h" | 36 #include "ui/views/controls/button/vector_icon_button.h" |
| 37 | 37 |
| 38 class DownloadShelfView; | 38 class DownloadShelfView; |
| 39 class DownloadShelfContextMenuView; | 39 class DownloadShelfContextMenuView; |
| 40 | 40 |
| 41 namespace extensions { | 41 namespace extensions { |
| 42 class ExperienceSamplingEvent; | 42 class ExperienceSamplingEvent; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace gfx { | 45 namespace gfx { |
| 46 class Image; | 46 class Image; |
| 47 class ImageSkia; | 47 class ImageSkia; |
| 48 class SlideAnimation; | 48 class SlideAnimation; |
| 49 } | 49 } |
| 50 | 50 |
| 51 namespace ui { | 51 namespace ui { |
| 52 class ThemeProvider; | 52 class ThemeProvider; |
| 53 } | 53 } |
| 54 | 54 |
| 55 namespace views { | 55 namespace views { |
| 56 class ImageButton; | 56 class ImageButton; |
| 57 class Label; | 57 class Label; |
| 58 class LabelButton; | 58 class LabelButton; |
| 59 } | 59 } |
| 60 | 60 |
| 61 // The DownloadItemView in MD style. This is copied from DownloadItemView, | 61 // The DownloadItemView in MD style. This is copied from DownloadItemView, |
| 62 // which it should eventually replace. | 62 // which it should eventually replace. |
| 63 class DownloadItemViewMd : public views::InkDropHostView, | 63 class DownloadItemViewMd : public views::InkDropHostView, |
| 64 public views::ButtonListener, | 64 public views::VectorIconButtonDelegate, |
| 65 public views::ContextMenuController, | 65 public views::ContextMenuController, |
| 66 public content::DownloadItem::Observer, | 66 public content::DownloadItem::Observer, |
| 67 public gfx::AnimationDelegate { | 67 public gfx::AnimationDelegate { |
| 68 public: | 68 public: |
| 69 DownloadItemViewMd(content::DownloadItem* download, | 69 DownloadItemViewMd(content::DownloadItem* download, |
| 70 DownloadShelfView* parent); | 70 DownloadShelfView* parent); |
| 71 ~DownloadItemViewMd() override; | 71 ~DownloadItemViewMd() override; |
| 72 | 72 |
| 73 // Timer callback for handling animations | 73 // Timer callback for handling animations |
| 74 void UpdateDownloadProgress(); | 74 void UpdateDownloadProgress(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 const override; | 109 const override; |
| 110 | 110 |
| 111 // Overridden from ui::EventHandler: | 111 // Overridden from ui::EventHandler: |
| 112 void OnGestureEvent(ui::GestureEvent* event) override; | 112 void OnGestureEvent(ui::GestureEvent* event) override; |
| 113 | 113 |
| 114 // Overridden from views::ContextMenuController. | 114 // Overridden from views::ContextMenuController. |
| 115 void ShowContextMenuForView(View* source, | 115 void ShowContextMenuForView(View* source, |
| 116 const gfx::Point& point, | 116 const gfx::Point& point, |
| 117 ui::MenuSourceType source_type) override; | 117 ui::MenuSourceType source_type) override; |
| 118 | 118 |
| 119 // ButtonListener implementation. | 119 // VectorIconButtonDelegate implementation. |
| 120 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 120 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 121 SkColor GetVectorIconBaseColor() const override; |
| 121 | 122 |
| 122 // gfx::AnimationDelegate implementation. | 123 // gfx::AnimationDelegate implementation. |
| 123 void AnimationProgressed(const gfx::Animation* animation) override; | 124 void AnimationProgressed(const gfx::Animation* animation) override; |
| 124 | 125 |
| 125 protected: | 126 protected: |
| 126 // Overridden from views::View: | 127 // Overridden from views::View: |
| 127 void OnPaint(gfx::Canvas* canvas) override; | 128 void OnPaint(gfx::Canvas* canvas) override; |
| 128 void OnFocus() override; | 129 void OnFocus() override; |
| 129 void OnBlur() override; | 130 void OnBlur() override; |
| 130 | 131 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 std::unique_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 320 std::unique_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
| 320 | 321 |
| 321 // Method factory used to delay reenabling of the item when opening the | 322 // Method factory used to delay reenabling of the item when opening the |
| 322 // downloaded file. | 323 // downloaded file. |
| 323 base::WeakPtrFactory<DownloadItemViewMd> weak_ptr_factory_; | 324 base::WeakPtrFactory<DownloadItemViewMd> weak_ptr_factory_; |
| 324 | 325 |
| 325 DISALLOW_COPY_AND_ASSIGN(DownloadItemViewMd); | 326 DISALLOW_COPY_AND_ASSIGN(DownloadItemViewMd); |
| 326 }; | 327 }; |
| 327 | 328 |
| 328 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_MD_H_ | 329 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_MD_H_ |
| OLD | NEW |