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

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

Issue 6154001: Move animation code to new ui/base/animation directory.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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.
11 // 11 //
12 // The DownloadItemView lives in the Browser, and has a corresponding 12 // The DownloadItemView lives in the Browser, and has a corresponding
13 // DownloadController that receives / writes data which lives in the 13 // DownloadController that receives / writes data which lives in the
14 // Renderer. 14 // Renderer.
15 15
16 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_ITEM_VIEW_H__ 16 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_ITEM_VIEW_H__
17 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_ITEM_VIEW_H__ 17 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_ITEM_VIEW_H__
18 #pragma once 18 #pragma once
19 19
20 #include <string> 20 #include <string>
21 21
22 #include "app/animation_delegate.h"
23 #include "base/basictypes.h" 22 #include "base/basictypes.h"
24 #include "base/scoped_ptr.h" 23 #include "base/scoped_ptr.h"
25 #include "base/time.h" 24 #include "base/time.h"
26 #include "base/timer.h" 25 #include "base/timer.h"
27 #include "chrome/browser/cancelable_request.h" 26 #include "chrome/browser/cancelable_request.h"
28 #include "chrome/browser/download/download_item.h" 27 #include "chrome/browser/download/download_item.h"
29 #include "chrome/browser/download/download_manager.h" 28 #include "chrome/browser/download/download_manager.h"
30 #include "chrome/browser/icon_manager.h" 29 #include "chrome/browser/icon_manager.h"
31 #include "gfx/font.h" 30 #include "gfx/font.h"
31 #include "ui/base/animation/animation_delegate.h"
32 #include "views/event.h" 32 #include "views/event.h"
33 #include "views/controls/button/button.h" 33 #include "views/controls/button/button.h"
34 #include "views/view.h" 34 #include "views/view.h"
35 35
36 class BaseDownloadItemModel;
37 class DownloadShelfView;
38 class SkBitmap;
39 class DownloadShelfContextMenuWin;
40
41 namespace ui {
42 class SlideAnimation;
43 }
44
36 namespace views { 45 namespace views {
37 class Label; 46 class Label;
38 class NativeButton; 47 class NativeButton;
39 } 48 }
40 class BaseDownloadItemModel;
41 class DownloadShelfView;
42 class SkBitmap;
43 class DownloadShelfContextMenuWin;
44 class SlideAnimation;
45 49
46 class DownloadItemView : public views::ButtonListener, 50 class DownloadItemView : public views::ButtonListener,
47 public views::View, 51 public views::View,
48 public DownloadItem::Observer, 52 public DownloadItem::Observer,
49 public AnimationDelegate { 53 public ui::AnimationDelegate {
50 public: 54 public:
51 DownloadItemView(DownloadItem* download, 55 DownloadItemView(DownloadItem* download,
52 DownloadShelfView* parent, 56 DownloadShelfView* parent,
53 BaseDownloadItemModel* model); 57 BaseDownloadItemModel* model);
54 virtual ~DownloadItemView(); 58 virtual ~DownloadItemView();
55 59
56 // DownloadObserver method 60 // DownloadObserver method
57 virtual void OnDownloadUpdated(DownloadItem* download); 61 virtual void OnDownloadUpdated(DownloadItem* download);
58 virtual void OnDownloadFileCompleted(DownloadItem* download) { } 62 virtual void OnDownloadFileCompleted(DownloadItem* download) { }
59 virtual void OnDownloadOpened(DownloadItem* download); 63 virtual void OnDownloadOpened(DownloadItem* download);
60 64
61 // View overrides 65 // View overrides
62 virtual void Layout(); 66 virtual void Layout();
63 virtual void Paint(gfx::Canvas* canvas); 67 virtual void Paint(gfx::Canvas* canvas);
64 virtual gfx::Size GetPreferredSize(); 68 virtual gfx::Size GetPreferredSize();
65 virtual void OnMouseExited(const views::MouseEvent& event); 69 virtual void OnMouseExited(const views::MouseEvent& event);
66 virtual void OnMouseMoved(const views::MouseEvent& event); 70 virtual void OnMouseMoved(const views::MouseEvent& event);
67 virtual bool OnMousePressed(const views::MouseEvent& event); 71 virtual bool OnMousePressed(const views::MouseEvent& event);
68 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); 72 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
69 virtual bool OnMouseDragged(const views::MouseEvent& event); 73 virtual bool OnMouseDragged(const views::MouseEvent& event);
70 virtual bool OnKeyPressed(const views::KeyEvent& e); 74 virtual bool OnKeyPressed(const views::KeyEvent& e);
71 virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture); 75 virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture);
72 virtual AccessibilityTypes::Role GetAccessibleRole(); 76 virtual AccessibilityTypes::Role GetAccessibleRole();
73 virtual AccessibilityTypes::State GetAccessibleState(); 77 virtual AccessibilityTypes::State GetAccessibleState();
74 78
75 // ButtonListener implementation. 79 // ButtonListener implementation.
76 virtual void ButtonPressed(views::Button* sender, const views::Event& event); 80 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
77 81
78 // AnimationDelegate implementation. 82 // ui::AnimationDelegate implementation.
79 virtual void AnimationProgressed(const Animation* animation); 83 virtual void AnimationProgressed(const ui::Animation* animation);
80 84
81 // Timer callback for handling animations 85 // Timer callback for handling animations
82 void UpdateDownloadProgress(); 86 void UpdateDownloadProgress();
83 void StartDownloadProgress(); 87 void StartDownloadProgress();
84 void StopDownloadProgress(); 88 void StopDownloadProgress();
85 89
86 // IconManager::Client interface. 90 // IconManager::Client interface.
87 void OnExtractIconComplete(IconManager::Handle handle, SkBitmap* icon_bitmap); 91 void OnExtractIconComplete(IconManager::Handle handle, SkBitmap* icon_bitmap);
88 92
89 // Returns the DownloadItem model object belonging to this item. 93 // Returns the DownloadItem model object belonging to this item.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 228
225 // For canceling an in progress icon request. 229 // For canceling an in progress icon request.
226 CancelableRequestConsumerT<int, 0> icon_consumer_; 230 CancelableRequestConsumerT<int, 0> icon_consumer_;
227 231
228 // A model class to control the status text we display and the cancel 232 // A model class to control the status text we display and the cancel
229 // behavior. 233 // behavior.
230 // This class owns the pointer. 234 // This class owns the pointer.
231 scoped_ptr<BaseDownloadItemModel> model_; 235 scoped_ptr<BaseDownloadItemModel> model_;
232 236
233 // Hover animations for our body and drop buttons. 237 // Hover animations for our body and drop buttons.
234 scoped_ptr<SlideAnimation> body_hover_animation_; 238 scoped_ptr<ui::SlideAnimation> body_hover_animation_;
235 scoped_ptr<SlideAnimation> drop_hover_animation_; 239 scoped_ptr<ui::SlideAnimation> drop_hover_animation_;
236 240
237 // Animation for download complete. 241 // Animation for download complete.
238 scoped_ptr<SlideAnimation> complete_animation_; 242 scoped_ptr<ui::SlideAnimation> complete_animation_;
239 243
240 // Progress animation 244 // Progress animation
241 base::RepeatingTimer<DownloadItemView> progress_timer_; 245 base::RepeatingTimer<DownloadItemView> progress_timer_;
242 246
243 // Dangerous mode buttons. 247 // Dangerous mode buttons.
244 views::NativeButton* save_button_; 248 views::NativeButton* save_button_;
245 views::NativeButton* discard_button_; 249 views::NativeButton* discard_button_;
246 250
247 // Dangerous mode label. 251 // Dangerous mode label.
248 views::Label* dangerous_download_label_; 252 views::Label* dangerous_download_label_;
(...skipping 19 matching lines...) Expand all
268 272
269 // If non-NULL, set to true when this object is deleted. 273 // If non-NULL, set to true when this object is deleted.
270 // (Used when showing the context menu as it runs an inner message loop that 274 // (Used when showing the context menu as it runs an inner message loop that
271 // might delete us). 275 // might delete us).
272 bool* deleted_; 276 bool* deleted_;
273 277
274 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); 278 DISALLOW_COPY_AND_ASSIGN(DownloadItemView);
275 }; 279 };
276 280
277 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_ITEM_VIEW_H__ 281 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_ITEM_VIEW_H__
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/browser_actions_container.cc ('k') | chrome/browser/ui/views/download_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698