| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_VIEWS_DOWNLOAD_ITEM_VIEW_H__ | 16 #ifndef CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H__ |
| 17 #define CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H__ | 17 #define CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H__ |
| 18 | 18 |
| 19 #include <string> | 19 #include <string> |
| 20 | 20 |
| 21 #include "app/gfx/chrome_font.h" | 21 #include "app/gfx/font.h" |
| 22 #include "app/slide_animation.h" | 22 #include "app/slide_animation.h" |
| 23 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
| 24 #include "base/scoped_ptr.h" | 24 #include "base/scoped_ptr.h" |
| 25 #include "base/time.h" | 25 #include "base/time.h" |
| 26 #include "base/timer.h" | 26 #include "base/timer.h" |
| 27 #include "chrome/browser/cancelable_request.h" | 27 #include "chrome/browser/cancelable_request.h" |
| 28 #include "chrome/browser/download/download_manager.h" | 28 #include "chrome/browser/download/download_manager.h" |
| 29 #include "chrome/browser/icon_manager.h" | 29 #include "chrome/browser/icon_manager.h" |
| 30 #include "views/event.h" | 30 #include "views/event.h" |
| 31 #include "views/controls/button/button.h" | 31 #include "views/controls/button/button.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 48 DownloadShelfView* parent, | 48 DownloadShelfView* parent, |
| 49 BaseDownloadItemModel* model); | 49 BaseDownloadItemModel* model); |
| 50 virtual ~DownloadItemView(); | 50 virtual ~DownloadItemView(); |
| 51 | 51 |
| 52 // DownloadObserver method | 52 // DownloadObserver method |
| 53 virtual void OnDownloadUpdated(DownloadItem* download); | 53 virtual void OnDownloadUpdated(DownloadItem* download); |
| 54 virtual void OnDownloadOpened(DownloadItem* download); | 54 virtual void OnDownloadOpened(DownloadItem* download); |
| 55 | 55 |
| 56 // View overrides | 56 // View overrides |
| 57 virtual void Layout(); | 57 virtual void Layout(); |
| 58 virtual void Paint(ChromeCanvas* canvas); | 58 virtual void Paint(gfx::Canvas* canvas); |
| 59 virtual gfx::Size GetPreferredSize(); | 59 virtual gfx::Size GetPreferredSize(); |
| 60 virtual void OnMouseExited(const views::MouseEvent& event); | 60 virtual void OnMouseExited(const views::MouseEvent& event); |
| 61 virtual void OnMouseMoved(const views::MouseEvent& event); | 61 virtual void OnMouseMoved(const views::MouseEvent& event); |
| 62 virtual bool OnMousePressed(const views::MouseEvent& event); | 62 virtual bool OnMousePressed(const views::MouseEvent& event); |
| 63 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); | 63 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); |
| 64 virtual bool OnMouseDragged(const views::MouseEvent& event); | 64 virtual bool OnMouseDragged(const views::MouseEvent& event); |
| 65 | 65 |
| 66 // ButtonListener implementation. | 66 // ButtonListener implementation. |
| 67 virtual void ButtonPressed(views::Button* sender); | 67 virtual void ButtonPressed(views::Button* sender); |
| 68 | 68 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 SkBitmap* center; | 104 SkBitmap* center; |
| 105 SkBitmap* bottom; | 105 SkBitmap* bottom; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 void OpenDownload(); | 108 void OpenDownload(); |
| 109 | 109 |
| 110 void LoadIcon(); | 110 void LoadIcon(); |
| 111 | 111 |
| 112 // Convenience method to paint the 3 vertical bitmaps (bottom, middle, top) | 112 // Convenience method to paint the 3 vertical bitmaps (bottom, middle, top) |
| 113 // that form the background. | 113 // that form the background. |
| 114 void PaintBitmaps(ChromeCanvas* canvas, | 114 void PaintBitmaps(gfx::Canvas* canvas, |
| 115 const SkBitmap* top_bitmap, | 115 const SkBitmap* top_bitmap, |
| 116 const SkBitmap* center_bitmap, | 116 const SkBitmap* center_bitmap, |
| 117 const SkBitmap* bottom_bitmap, | 117 const SkBitmap* bottom_bitmap, |
| 118 int x, | 118 int x, |
| 119 int y, | 119 int y, |
| 120 int height, | 120 int height, |
| 121 int width); | 121 int width); |
| 122 | 122 |
| 123 // Sets the state and triggers a repaint. | 123 // Sets the state and triggers a repaint. |
| 124 void SetState(State body_state, State drop_down_state); | 124 void SetState(State body_state, State drop_down_state); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 base::Time creation_time_; | 233 base::Time creation_time_; |
| 234 | 234 |
| 235 // Method factory used to delay reenabling of the item when opening the | 235 // Method factory used to delay reenabling of the item when opening the |
| 236 // downloaded file. | 236 // downloaded file. |
| 237 ScopedRunnableMethodFactory<DownloadItemView> reenable_method_factory_; | 237 ScopedRunnableMethodFactory<DownloadItemView> reenable_method_factory_; |
| 238 | 238 |
| 239 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); | 239 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 #endif // CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H__ | 242 #endif // CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H__ |
| OLD | NEW |