OLD | NEW |
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. |
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_DOWNLOAD_ITEM_VIEW_H__ | 16 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ |
17 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ | 17 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ |
18 | 18 |
19 #include <string> | 19 #include <string> |
20 | 20 |
21 #include "base/basictypes.h" | 21 #include "base/basictypes.h" |
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/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 "chrome/browser/ui/views/download/download_feedback_dialog_view.h" |
30 #include "content/public/browser/download_item.h" | 31 #include "content/public/browser/download_item.h" |
31 #include "content/public/browser/download_manager.h" | 32 #include "content/public/browser/download_manager.h" |
32 #include "ui/gfx/animation/animation_delegate.h" | 33 #include "ui/gfx/animation/animation_delegate.h" |
33 #include "ui/gfx/font_list.h" | 34 #include "ui/gfx/font_list.h" |
34 #include "ui/views/context_menu_controller.h" | 35 #include "ui/views/context_menu_controller.h" |
35 #include "ui/views/controls/button/button.h" | 36 #include "ui/views/controls/button/button.h" |
36 #include "ui/views/view.h" | 37 #include "ui/views/view.h" |
37 | 38 |
38 class DownloadShelfView; | 39 class DownloadShelfView; |
39 class DownloadShelfContextMenuView; | 40 class DownloadShelfContextMenuView; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 140 |
140 // The image set associated with the drop-down button on the right. | 141 // The image set associated with the drop-down button on the right. |
141 struct DropDownImageSet { | 142 struct DropDownImageSet { |
142 gfx::ImageSkia* top; | 143 gfx::ImageSkia* top; |
143 gfx::ImageSkia* center; | 144 gfx::ImageSkia* center; |
144 gfx::ImageSkia* bottom; | 145 gfx::ImageSkia* bottom; |
145 }; | 146 }; |
146 | 147 |
147 void OpenDownload(); | 148 void OpenDownload(); |
148 | 149 |
149 // Submit the downloaded file to the safebrowsing download feedback service. | 150 // Submits the downloaded file to the safebrowsing download feedback service. |
150 // If true is returned, the DownloadItem and |this| have been deleted. If | 151 // Returns whether submission was successful. On successful submission, |
151 // false is returned, nothing has changed. | 152 // |this| and the DownloadItem will have been deleted. |
152 bool BeginDownloadFeedback(); | 153 bool SubmitDownloadToFeedbackService(); |
| 154 |
| 155 // If the user has enabled uploading, calls SubmitDownloadToFeedbackService. |
| 156 // Otherwise, it simply removes the DownloadItem without uploading. |
| 157 void PossiblySubmitDownloadToFeedbackService( |
| 158 DownloadFeedbackDialogView::DownloadReportingStatus status); |
153 | 159 |
154 void LoadIcon(); | 160 void LoadIcon(); |
155 void LoadIconIfItemPathChanged(); | 161 void LoadIconIfItemPathChanged(); |
156 | 162 |
157 // Update the button colors based on the current theme. | 163 // Update the button colors based on the current theme. |
158 void UpdateColorsFromTheme(); | 164 void UpdateColorsFromTheme(); |
159 | 165 |
160 // Shows the context menu at the specified location. |point| is in the view's | 166 // Shows the context menu at the specified location. |point| is in the view's |
161 // coordinate system. | 167 // coordinate system. |
162 void ShowContextMenuImpl(const gfx::Point& point, | 168 void ShowContextMenuImpl(const gfx::Point& point, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 338 |
333 // The icon loaded in the download shelf is based on the file path of the | 339 // The icon loaded in the download shelf is based on the file path of the |
334 // item. Store the path used, so that we can detect a change in the path | 340 // item. Store the path used, so that we can detect a change in the path |
335 // and reload the icon. | 341 // and reload the icon. |
336 base::FilePath last_download_item_path_; | 342 base::FilePath last_download_item_path_; |
337 | 343 |
338 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); | 344 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); |
339 }; | 345 }; |
340 | 346 |
341 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ | 347 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ |
OLD | NEW |