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

Side by Side Diff: chrome/browser/ui/views/download/download_item_view_md.h

Issue 1832963002: MD - add ripples to DL shelf items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: worth reviewing Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 #include "base/strings/string_util.h" 24 #include "base/strings/string_util.h"
25 #include "base/task/cancelable_task_tracker.h" 25 #include "base/task/cancelable_task_tracker.h"
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/button_ink_drop_delegate.h"
35 #include "ui/views/animation/ink_drop_host_view.h"
34 #include "ui/views/context_menu_controller.h" 36 #include "ui/views/context_menu_controller.h"
35 #include "ui/views/controls/button/button.h" 37 #include "ui/views/controls/button/button.h"
36 #include "ui/views/view.h"
37 38
38 class BarControlButton; 39 class BarControlButton;
39 class DownloadShelfView; 40 class DownloadShelfView;
40 class DownloadShelfContextMenuView; 41 class DownloadShelfContextMenuView;
41 42
42 namespace extensions { 43 namespace extensions {
43 class ExperienceSamplingEvent; 44 class ExperienceSamplingEvent;
44 } 45 }
45 46
46 namespace gfx { 47 namespace gfx {
47 class Image; 48 class Image;
48 class ImageSkia; 49 class ImageSkia;
49 class SlideAnimation; 50 class SlideAnimation;
50 } 51 }
51 52
52 namespace ui { 53 namespace ui {
53 class ThemeProvider; 54 class ThemeProvider;
54 } 55 }
55 56
56 namespace views { 57 namespace views {
57 class ImageButton; 58 class ImageButton;
58 class Label; 59 class Label;
59 class LabelButton; 60 class LabelButton;
60 } 61 }
61 62
62 // The DownloadItemView in MD style. This is copied from DownloadItemView, 63 // The DownloadItemView in MD style. This is copied from DownloadItemView,
63 // which it should eventually replace. 64 // which it should eventually replace.
64 class DownloadItemViewMd : public views::ButtonListener, 65 class DownloadItemViewMd : public views::InkDropHostView,
65 public views::View, 66 public views::ButtonListener,
66 public views::ContextMenuController, 67 public views::ContextMenuController,
67 public content::DownloadItem::Observer, 68 public content::DownloadItem::Observer,
68 public gfx::AnimationDelegate { 69 public gfx::AnimationDelegate {
69 public: 70 public:
70 DownloadItemViewMd(content::DownloadItem* download, 71 DownloadItemViewMd(content::DownloadItem* download,
71 DownloadShelfView* parent); 72 DownloadShelfView* parent);
72 ~DownloadItemViewMd() override; 73 ~DownloadItemViewMd() override;
73 74
74 // Timer callback for handling animations 75 // Timer callback for handling animations
75 void UpdateDownloadProgress(); 76 void UpdateDownloadProgress();
(...skipping 14 matching lines...) Expand all
90 void OnDownloadOpened(content::DownloadItem* download) override; 91 void OnDownloadOpened(content::DownloadItem* download) override;
91 void OnDownloadDestroyed(content::DownloadItem* download) override; 92 void OnDownloadDestroyed(content::DownloadItem* download) override;
92 93
93 // Overridden from views::View: 94 // Overridden from views::View:
94 void Layout() override; 95 void Layout() override;
95 gfx::Size GetPreferredSize() const override; 96 gfx::Size GetPreferredSize() const override;
96 bool OnMousePressed(const ui::MouseEvent& event) override; 97 bool OnMousePressed(const ui::MouseEvent& event) override;
97 bool OnMouseDragged(const ui::MouseEvent& event) override; 98 bool OnMouseDragged(const ui::MouseEvent& event) override;
98 void OnMouseReleased(const ui::MouseEvent& event) override; 99 void OnMouseReleased(const ui::MouseEvent& event) override;
99 void OnMouseCaptureLost() override; 100 void OnMouseCaptureLost() override;
101 void OnMouseEntered(const ui::MouseEvent& event) override;
102 void OnMouseExited(const ui::MouseEvent& event) override;
100 bool OnKeyPressed(const ui::KeyEvent& event) override; 103 bool OnKeyPressed(const ui::KeyEvent& event) override;
101 bool GetTooltipText(const gfx::Point& p, 104 bool GetTooltipText(const gfx::Point& p,
102 base::string16* tooltip) const override; 105 base::string16* tooltip) const override;
106 void OnDragDone() override;
103 void GetAccessibleState(ui::AXViewState* state) override; 107 void GetAccessibleState(ui::AXViewState* state) override;
104 void OnThemeChanged() override; 108 void OnThemeChanged() override;
105 109
110 // Overridden from view::InkDropHostView:
111 scoped_ptr<views::InkDropAnimation> CreateInkDropAnimation() const override;
112 scoped_ptr<views::InkDropHover> CreateInkDropHover() const override;
113
106 // Overridden from ui::EventHandler: 114 // Overridden from ui::EventHandler:
107 void OnGestureEvent(ui::GestureEvent* event) override; 115 void OnGestureEvent(ui::GestureEvent* event) override;
108 116
109 // Overridden from views::ContextMenuController. 117 // Overridden from views::ContextMenuController.
110 void ShowContextMenuForView(View* source, 118 void ShowContextMenuForView(View* source,
111 const gfx::Point& point, 119 const gfx::Point& point,
112 ui::MenuSourceType source_type) override; 120 ui::MenuSourceType source_type) override;
113 121
114 // ButtonListener implementation. 122 // ButtonListener implementation.
115 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 123 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // Show/Hide/Reset |animation| based on the state transition specified by 221 // Show/Hide/Reset |animation| based on the state transition specified by
214 // |from| and |to|. 222 // |from| and |to|.
215 void AnimateStateTransition(State from, 223 void AnimateStateTransition(State from,
216 State to, 224 State to,
217 gfx::SlideAnimation* animation); 225 gfx::SlideAnimation* animation);
218 226
219 // Callback for |progress_timer_|. 227 // Callback for |progress_timer_|.
220 void ProgressTimerFired(); 228 void ProgressTimerFired();
221 229
222 // Returns the base text color. 230 // Returns the base text color.
223 SkColor GetTextColor(); 231 SkColor GetTextColor() const;
224 232
225 // Returns a slightly dimmed version of the base text color. 233 // Returns a slightly dimmed version of the base text color.
226 SkColor GetDimmedTextColor(); 234 SkColor GetDimmedTextColor() const;
227 235
228 // The download shelf that owns us. 236 // The download shelf that owns us.
229 DownloadShelfView* shelf_; 237 DownloadShelfView* shelf_;
230 238
231 // Elements of our particular download 239 // Elements of our particular download
232 base::string16 status_text_; 240 base::string16 status_text_;
233 241
234 // The font list used to print the file name and warning text. 242 // The font list used to print the file name and warning text.
235 gfx::FontList font_list_; 243 gfx::FontList font_list_;
236 244
(...skipping 19 matching lines...) Expand all
256 264
257 // Whether we are dragging the download button. 265 // Whether we are dragging the download button.
258 bool dragging_; 266 bool dragging_;
259 267
260 // Whether we are tracking a possible drag. 268 // Whether we are tracking a possible drag.
261 bool starting_drag_; 269 bool starting_drag_;
262 270
263 // Position that a possible drag started at. 271 // Position that a possible drag started at.
264 gfx::Point drag_start_point_; 272 gfx::Point drag_start_point_;
265 273
274 // Position (in coordinate system of |this|) of the last event that triggered
275 // an ink drop.
276 gfx::Point last_ink_drop_location_;
277
266 // For canceling an in progress icon request. 278 // For canceling an in progress icon request.
267 base::CancelableTaskTracker cancelable_task_tracker_; 279 base::CancelableTaskTracker cancelable_task_tracker_;
268 280
269 // A model class to control the status text we display. 281 // A model class to control the status text we display.
270 DownloadItemModel model_; 282 DownloadItemModel model_;
271 283
272 // Hover animations for our body and drop buttons.
273 scoped_ptr<gfx::SlideAnimation> body_hover_animation_;
274 scoped_ptr<gfx::SlideAnimation> drop_hover_animation_;
275
276 // Animation for download complete. 284 // Animation for download complete.
277 scoped_ptr<gfx::SlideAnimation> complete_animation_; 285 scoped_ptr<gfx::SlideAnimation> complete_animation_;
278 286
287 views::ButtonInkDropDelegate ink_drop_delegate_;
288
279 // Progress animation 289 // Progress animation
280 base::RepeatingTimer progress_timer_; 290 base::RepeatingTimer progress_timer_;
281 291
282 // Dangerous mode buttons. 292 // Dangerous mode buttons.
283 views::LabelButton* save_button_; 293 views::LabelButton* save_button_;
284 views::LabelButton* discard_button_; 294 views::LabelButton* discard_button_;
285 295
286 // The drop down button. 296 // The drop down button.
287 BarControlButton* dropdown_button_; 297 BarControlButton* dropdown_button_;
288 298
(...skipping 28 matching lines...) Expand all
317 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; 327 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_;
318 328
319 // Method factory used to delay reenabling of the item when opening the 329 // Method factory used to delay reenabling of the item when opening the
320 // downloaded file. 330 // downloaded file.
321 base::WeakPtrFactory<DownloadItemViewMd> weak_ptr_factory_; 331 base::WeakPtrFactory<DownloadItemViewMd> weak_ptr_factory_;
322 332
323 DISALLOW_COPY_AND_ASSIGN(DownloadItemViewMd); 333 DISALLOW_COPY_AND_ASSIGN(DownloadItemViewMd);
324 }; 334 };
325 335
326 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_MD_H_ 336 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_MD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698