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

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: fix another TODO 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_item_view_md.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 20 matching lines...) Expand all
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;
100 bool OnKeyPressed(const ui::KeyEvent& event) override; 101 bool OnKeyPressed(const ui::KeyEvent& event) override;
101 bool GetTooltipText(const gfx::Point& p, 102 bool GetTooltipText(const gfx::Point& p,
102 base::string16* tooltip) const override; 103 base::string16* tooltip) const override;
103 void GetAccessibleState(ui::AXViewState* state) override; 104 void GetAccessibleState(ui::AXViewState* state) override;
104 void OnThemeChanged() override; 105 void OnThemeChanged() override;
105 106
107 // Overridden from view::InkDropHostView:
108 void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
109 scoped_ptr<views::InkDropAnimation> CreateInkDropAnimation() const override;
110 scoped_ptr<views::InkDropHover> CreateInkDropHover() const override;
111
106 // Overridden from ui::EventHandler: 112 // Overridden from ui::EventHandler:
107 void OnGestureEvent(ui::GestureEvent* event) override; 113 void OnGestureEvent(ui::GestureEvent* event) override;
108 114
109 // Overridden from views::ContextMenuController. 115 // Overridden from views::ContextMenuController.
110 void ShowContextMenuForView(View* source, 116 void ShowContextMenuForView(View* source,
111 const gfx::Point& point, 117 const gfx::Point& point,
112 ui::MenuSourceType source_type) override; 118 ui::MenuSourceType source_type) override;
113 119
114 // ButtonListener implementation. 120 // ButtonListener implementation.
115 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 121 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 219 // Show/Hide/Reset |animation| based on the state transition specified by
214 // |from| and |to|. 220 // |from| and |to|.
215 void AnimateStateTransition(State from, 221 void AnimateStateTransition(State from,
216 State to, 222 State to,
217 gfx::SlideAnimation* animation); 223 gfx::SlideAnimation* animation);
218 224
219 // Callback for |progress_timer_|. 225 // Callback for |progress_timer_|.
220 void ProgressTimerFired(); 226 void ProgressTimerFired();
221 227
222 // Returns the base text color. 228 // Returns the base text color.
223 SkColor GetTextColor(); 229 SkColor GetTextColor() const;
224 230
225 // Returns a slightly dimmed version of the base text color. 231 // Returns a slightly dimmed version of the base text color.
226 SkColor GetDimmedTextColor(); 232 SkColor GetDimmedTextColor() const;
227 233
228 // The download shelf that owns us. 234 // The download shelf that owns us.
229 DownloadShelfView* shelf_; 235 DownloadShelfView* shelf_;
230 236
231 // Elements of our particular download 237 // Elements of our particular download
232 base::string16 status_text_; 238 base::string16 status_text_;
233 239
234 // The font list used to print the file name and warning text. 240 // The font list used to print the file name and warning text.
235 gfx::FontList font_list_; 241 gfx::FontList font_list_;
236 242
(...skipping 25 matching lines...) Expand all
262 268
263 // Position that a possible drag started at. 269 // Position that a possible drag started at.
264 gfx::Point drag_start_point_; 270 gfx::Point drag_start_point_;
265 271
266 // For canceling an in progress icon request. 272 // For canceling an in progress icon request.
267 base::CancelableTaskTracker cancelable_task_tracker_; 273 base::CancelableTaskTracker cancelable_task_tracker_;
268 274
269 // A model class to control the status text we display. 275 // A model class to control the status text we display.
270 DownloadItemModel model_; 276 DownloadItemModel model_;
271 277
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. 278 // Animation for download complete.
277 scoped_ptr<gfx::SlideAnimation> complete_animation_; 279 scoped_ptr<gfx::SlideAnimation> complete_animation_;
278 280
281 views::ButtonInkDropDelegate ink_drop_delegate_;
282
279 // Progress animation 283 // Progress animation
280 base::RepeatingTimer progress_timer_; 284 base::RepeatingTimer progress_timer_;
281 285
282 // Dangerous mode buttons. 286 // Dangerous mode buttons.
283 views::LabelButton* save_button_; 287 views::LabelButton* save_button_;
284 views::LabelButton* discard_button_; 288 views::LabelButton* discard_button_;
285 289
286 // The drop down button. 290 // The drop down button.
287 BarControlButton* dropdown_button_; 291 BarControlButton* dropdown_button_;
288 292
(...skipping 28 matching lines...) Expand all
317 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; 321 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_;
318 322
319 // Method factory used to delay reenabling of the item when opening the 323 // Method factory used to delay reenabling of the item when opening the
320 // downloaded file. 324 // downloaded file.
321 base::WeakPtrFactory<DownloadItemViewMd> weak_ptr_factory_; 325 base::WeakPtrFactory<DownloadItemViewMd> weak_ptr_factory_;
322 326
323 DISALLOW_COPY_AND_ASSIGN(DownloadItemViewMd); 327 DISALLOW_COPY_AND_ASSIGN(DownloadItemViewMd);
324 }; 328 };
325 329
326 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_MD_H_ 330 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_MD_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_item_view_md.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698