| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Download utilities. | 5 // Download utilities. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
| 8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "app/gfx/chrome_canvas.h" | 13 #include "app/gfx/canvas.h" |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/task.h" | 15 #include "base/task.h" |
| 16 | 16 |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 #include "views/view.h" | 18 #include "views/view.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 class BaseDownloadItemModel; | 21 class BaseDownloadItemModel; |
| 22 class DownloadItem; | 22 class DownloadItem; |
| 23 class SkBitmap; | 23 class SkBitmap; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 // Paint the common download animation progress foreground and background, | 91 // Paint the common download animation progress foreground and background, |
| 92 // clipping the foreground to 'percent' full. If percent is -1, then we don't | 92 // clipping the foreground to 'percent' full. If percent is -1, then we don't |
| 93 // know the total size, so we just draw a rotating segment until we're done. | 93 // know the total size, so we just draw a rotating segment until we're done. |
| 94 // | 94 // |
| 95 // |containing_view| is the View subclass within which the progress animation | 95 // |containing_view| is the View subclass within which the progress animation |
| 96 // is drawn (generally either DownloadItemTabView or DownloadItemView). We | 96 // is drawn (generally either DownloadItemTabView or DownloadItemView). We |
| 97 // require the containing View in addition to the canvas because if we are | 97 // require the containing View in addition to the canvas because if we are |
| 98 // drawing in a right-to-left locale, we need to mirror the position of the | 98 // drawing in a right-to-left locale, we need to mirror the position of the |
| 99 // progress animation within the containing View. | 99 // progress animation within the containing View. |
| 100 void PaintDownloadProgress(ChromeCanvas* canvas, | 100 void PaintDownloadProgress(gfx::Canvas* canvas, |
| 101 #if defined(OS_WIN) | 101 #if defined(OS_WIN) |
| 102 views::View* containing_view, | 102 views::View* containing_view, |
| 103 #endif | 103 #endif |
| 104 int origin_x, | 104 int origin_x, |
| 105 int origin_y, | 105 int origin_y, |
| 106 int start_angle, | 106 int start_angle, |
| 107 int percent, | 107 int percent, |
| 108 PaintDownloadProgressSize size); | 108 PaintDownloadProgressSize size); |
| 109 | 109 |
| 110 void PaintDownloadComplete(ChromeCanvas* canvas, | 110 void PaintDownloadComplete(gfx::Canvas* canvas, |
| 111 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
| 112 views::View* containing_view, | 112 views::View* containing_view, |
| 113 #endif | 113 #endif |
| 114 int origin_x, | 114 int origin_x, |
| 115 int origin_y, | 115 int origin_y, |
| 116 double animation_progress, | 116 double animation_progress, |
| 117 PaintDownloadProgressSize size); | 117 PaintDownloadProgressSize size); |
| 118 | 118 |
| 119 #if defined(OS_WIN) | 119 #if defined(OS_WIN) |
| 120 // Drag support ---------------------------------------------------------------- | 120 // Drag support ---------------------------------------------------------------- |
| 121 | 121 |
| 122 // Helper function for download views to use when acting as a drag source for a | 122 // Helper function for download views to use when acting as a drag source for a |
| 123 // DownloadItem. If 'icon' is NULL, no image will be accompany the drag. | 123 // DownloadItem. If 'icon' is NULL, no image will be accompany the drag. |
| 124 void DragDownload(const DownloadItem* download, SkBitmap* icon); | 124 void DragDownload(const DownloadItem* download, SkBitmap* icon); |
| 125 | 125 |
| 126 // Executable file support ----------------------------------------------------- | 126 // Executable file support ----------------------------------------------------- |
| 127 | 127 |
| 128 // Copy all executable file extensions. | 128 // Copy all executable file extensions. |
| 129 void InitializeExeTypes(std::set<std::string>* exe_extensions); | 129 void InitializeExeTypes(std::set<std::string>* exe_extensions); |
| 130 #endif | 130 #endif |
| 131 | 131 |
| 132 } // namespace download_util | 132 } // namespace download_util |
| 133 | 133 |
| 134 | 134 |
| 135 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 135 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
| OLD | NEW |