OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 18 #pragma once |
19 | 19 |
20 #include <string> | 20 #include <string> |
21 | 21 |
22 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
| 24 #include "base/memory/weak_ptr.h" |
24 #include "base/string_util.h" | 25 #include "base/string_util.h" |
25 #include "base/time.h" | 26 #include "base/time.h" |
26 #include "base/timer.h" | 27 #include "base/timer.h" |
27 #include "chrome/browser/icon_manager.h" | 28 #include "chrome/browser/icon_manager.h" |
28 #include "content/browser/cancelable_request.h" | 29 #include "content/browser/cancelable_request.h" |
29 #include "content/browser/download/download_item.h" | 30 #include "content/browser/download/download_item.h" |
30 #include "content/browser/download/download_manager.h" | 31 #include "content/browser/download/download_manager.h" |
31 #include "ui/base/animation/animation_delegate.h" | 32 #include "ui/base/animation/animation_delegate.h" |
32 #include "ui/gfx/font.h" | 33 #include "ui/gfx/font.h" |
33 #include "views/controls/button/button.h" | 34 #include "views/controls/button/button.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 gfx::Size cached_button_size_; | 267 gfx::Size cached_button_size_; |
267 | 268 |
268 // Whether we are currently disabled as part of opening the downloaded file. | 269 // Whether we are currently disabled as part of opening the downloaded file. |
269 bool disabled_while_opening_; | 270 bool disabled_while_opening_; |
270 | 271 |
271 // The time at which this view was created. | 272 // The time at which this view was created. |
272 base::Time creation_time_; | 273 base::Time creation_time_; |
273 | 274 |
274 // Method factory used to delay reenabling of the item when opening the | 275 // Method factory used to delay reenabling of the item when opening the |
275 // downloaded file. | 276 // downloaded file. |
276 ScopedRunnableMethodFactory<DownloadItemView> reenable_method_factory_; | 277 base::WeakPtrFactory<DownloadItemView> reenable_method_factory_; |
277 | 278 |
278 // The currently running download context menu. | 279 // The currently running download context menu. |
279 scoped_ptr<DownloadShelfContextMenuView> context_menu_; | 280 scoped_ptr<DownloadShelfContextMenuView> context_menu_; |
280 | 281 |
281 // The name of this view as reported to assistive technology. | 282 // The name of this view as reported to assistive technology. |
282 string16 accessible_name_; | 283 string16 accessible_name_; |
283 | 284 |
284 // The icon loaded in the download shelf is based on the file path of the | 285 // The icon loaded in the download shelf is based on the file path of the |
285 // item. Store the path used, so that we can detect a change in the path | 286 // item. Store the path used, so that we can detect a change in the path |
286 // and reload the icon. | 287 // and reload the icon. |
287 FilePath last_download_item_path_; | 288 FilePath last_download_item_path_; |
288 | 289 |
289 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); | 290 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); |
290 }; | 291 }; |
291 | 292 |
292 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ | 293 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ |
OLD | NEW |