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

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

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 ChromeView that implements one download on the Download shelf. 5 // A ChromeView that implements one download on the Download shelf.
6 // Each DownloadItemView contains an application icon, a text label 6 // Each DownloadItemView 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 11 matching lines...) Expand all
22 #include "base/memory/scoped_ptr.h" 22 #include "base/memory/scoped_ptr.h"
23 #include "base/memory/weak_ptr.h" 23 #include "base/memory/weak_ptr.h"
24 #include "base/strings/string_util.h" 24 #include "base/strings/string_util.h"
25 #include "base/time/time.h" 25 #include "base/time/time.h"
26 #include "base/timer/timer.h" 26 #include "base/timer/timer.h"
27 #include "chrome/browser/download/download_item_model.h" 27 #include "chrome/browser/download/download_item_model.h"
28 #include "chrome/browser/icon_manager.h" 28 #include "chrome/browser/icon_manager.h"
29 #include "chrome/common/cancelable_task_tracker.h" 29 #include "chrome/common/cancelable_task_tracker.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/base/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/context_menu_controller.h" 34 #include "ui/views/context_menu_controller.h"
35 #include "ui/views/controls/button/button.h" 35 #include "ui/views/controls/button/button.h"
36 #include "ui/views/view.h" 36 #include "ui/views/view.h"
37 37
38 class DownloadShelfView; 38 class DownloadShelfView;
39 class DownloadShelfContextMenuView; 39 class DownloadShelfContextMenuView;
40 40
41 namespace gfx { 41 namespace gfx {
42 class Image; 42 class Image;
43 class ImageSkia; 43 class ImageSkia;
44 }
45
46 namespace ui {
47 class SlideAnimation; 44 class SlideAnimation;
48 } 45 }
49 46
50 namespace views { 47 namespace views {
51 class Label; 48 class Label;
52 class LabelButton; 49 class LabelButton;
53 } 50 }
54 51
55 class DownloadItemView : public views::ButtonListener, 52 class DownloadItemView : public views::ButtonListener,
56 public views::View, 53 public views::View,
57 public views::ContextMenuController, 54 public views::ContextMenuController,
58 public content::DownloadItem::Observer, 55 public content::DownloadItem::Observer,
59 public ui::AnimationDelegate { 56 public gfx::AnimationDelegate {
60 public: 57 public:
61 DownloadItemView(content::DownloadItem* download, 58 DownloadItemView(content::DownloadItem* download,
62 DownloadShelfView* parent); 59 DownloadShelfView* parent);
63 virtual ~DownloadItemView(); 60 virtual ~DownloadItemView();
64 61
65 // Timer callback for handling animations 62 // Timer callback for handling animations
66 void UpdateDownloadProgress(); 63 void UpdateDownloadProgress();
67 void StartDownloadProgress(); 64 void StartDownloadProgress();
68 void StopDownloadProgress(); 65 void StopDownloadProgress();
69 66
(...skipping 28 matching lines...) Expand all
98 95
99 // Overridden from views::ContextMenuController. 96 // Overridden from views::ContextMenuController.
100 virtual void ShowContextMenuForView(View* source, 97 virtual void ShowContextMenuForView(View* source,
101 const gfx::Point& point, 98 const gfx::Point& point,
102 ui::MenuSourceType source_type) OVERRIDE; 99 ui::MenuSourceType source_type) OVERRIDE;
103 100
104 // ButtonListener implementation. 101 // ButtonListener implementation.
105 virtual void ButtonPressed(views::Button* sender, 102 virtual void ButtonPressed(views::Button* sender,
106 const ui::Event& event) OVERRIDE; 103 const ui::Event& event) OVERRIDE;
107 104
108 // ui::AnimationDelegate implementation. 105 // gfx::AnimationDelegate implementation.
109 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 106 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
110 107
111 protected: 108 protected:
112 // Overridden from views::View: 109 // Overridden from views::View:
113 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 110 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
114 111
115 private: 112 private:
116 enum State { 113 enum State {
117 NORMAL = 0, 114 NORMAL = 0,
118 HOT, 115 HOT,
119 PUSHED 116 PUSHED
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // so that screenreaders can access the filename, status text, and 214 // so that screenreaders can access the filename, status text, and
218 // dangerous download warning message (if any). 215 // dangerous download warning message (if any).
219 void UpdateAccessibleName(); 216 void UpdateAccessibleName();
220 217
221 // Update the location of the drop down button. 218 // Update the location of the drop down button.
222 void UpdateDropDownButtonPosition(); 219 void UpdateDropDownButtonPosition();
223 220
224 // Show/Hide/Reset |animation| based on the state transition specified by 221 // Show/Hide/Reset |animation| based on the state transition specified by
225 // |from| and |to|. 222 // |from| and |to|.
226 void AnimateStateTransition(State from, State to, 223 void AnimateStateTransition(State from, State to,
227 ui::SlideAnimation* animation); 224 gfx::SlideAnimation* animation);
228 225
229 // The different images used for the background. 226 // The different images used for the background.
230 BodyImageSet normal_body_image_set_; 227 BodyImageSet normal_body_image_set_;
231 BodyImageSet hot_body_image_set_; 228 BodyImageSet hot_body_image_set_;
232 BodyImageSet pushed_body_image_set_; 229 BodyImageSet pushed_body_image_set_;
233 BodyImageSet dangerous_mode_body_image_set_; 230 BodyImageSet dangerous_mode_body_image_set_;
234 BodyImageSet malicious_mode_body_image_set_; 231 BodyImageSet malicious_mode_body_image_set_;
235 DropDownImageSet normal_drop_down_image_set_; 232 DropDownImageSet normal_drop_down_image_set_;
236 DropDownImageSet hot_drop_down_image_set_; 233 DropDownImageSet hot_drop_down_image_set_;
237 DropDownImageSet pushed_drop_down_image_set_; 234 DropDownImageSet pushed_drop_down_image_set_;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // Position that a possible drag started at. 280 // Position that a possible drag started at.
284 gfx::Point drag_start_point_; 281 gfx::Point drag_start_point_;
285 282
286 // For canceling an in progress icon request. 283 // For canceling an in progress icon request.
287 CancelableTaskTracker cancelable_task_tracker_; 284 CancelableTaskTracker cancelable_task_tracker_;
288 285
289 // A model class to control the status text we display. 286 // A model class to control the status text we display.
290 DownloadItemModel model_; 287 DownloadItemModel model_;
291 288
292 // Hover animations for our body and drop buttons. 289 // Hover animations for our body and drop buttons.
293 scoped_ptr<ui::SlideAnimation> body_hover_animation_; 290 scoped_ptr<gfx::SlideAnimation> body_hover_animation_;
294 scoped_ptr<ui::SlideAnimation> drop_hover_animation_; 291 scoped_ptr<gfx::SlideAnimation> drop_hover_animation_;
295 292
296 // Animation for download complete. 293 // Animation for download complete.
297 scoped_ptr<ui::SlideAnimation> complete_animation_; 294 scoped_ptr<gfx::SlideAnimation> complete_animation_;
298 295
299 // Progress animation 296 // Progress animation
300 base::RepeatingTimer<DownloadItemView> progress_timer_; 297 base::RepeatingTimer<DownloadItemView> progress_timer_;
301 298
302 // Dangerous mode buttons. 299 // Dangerous mode buttons.
303 views::LabelButton* save_button_; 300 views::LabelButton* save_button_;
304 views::LabelButton* discard_button_; 301 views::LabelButton* discard_button_;
305 302
306 // Dangerous mode label. 303 // Dangerous mode label.
307 views::Label* dangerous_download_label_; 304 views::Label* dangerous_download_label_;
(...skipping 22 matching lines...) Expand all
330 327
331 // The icon loaded in the download shelf is based on the file path of the 328 // The icon loaded in the download shelf is based on the file path of the
332 // item. Store the path used, so that we can detect a change in the path 329 // item. Store the path used, so that we can detect a change in the path
333 // and reload the icon. 330 // and reload the icon.
334 base::FilePath last_download_item_path_; 331 base::FilePath last_download_item_path_;
335 332
336 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); 333 DISALLOW_COPY_AND_ASSIGN(DownloadItemView);
337 }; 334 };
338 335
339 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ 336 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/browser_actions_container.cc ('k') | chrome/browser/ui/views/download/download_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698