| 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 <memory> |
| 19 #include <string> | 20 #include <string> |
| 20 | 21 |
| 21 #include "base/macros.h" | 22 #include "base/macros.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 "content/public/browser/download_item.h" | 30 #include "content/public/browser/download_item.h" |
| 31 #include "content/public/browser/download_manager.h" | 31 #include "content/public/browser/download_manager.h" |
| 32 #include "ui/gfx/animation/animation_delegate.h" | 32 #include "ui/gfx/animation/animation_delegate.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // Position that a possible drag started at. | 300 // Position that a possible drag started at. |
| 301 gfx::Point drag_start_point_; | 301 gfx::Point drag_start_point_; |
| 302 | 302 |
| 303 // For canceling an in progress icon request. | 303 // For canceling an in progress icon request. |
| 304 base::CancelableTaskTracker cancelable_task_tracker_; | 304 base::CancelableTaskTracker cancelable_task_tracker_; |
| 305 | 305 |
| 306 // A model class to control the status text we display. | 306 // A model class to control the status text we display. |
| 307 DownloadItemModel model_; | 307 DownloadItemModel model_; |
| 308 | 308 |
| 309 // Hover animations for our body and drop buttons. | 309 // Hover animations for our body and drop buttons. |
| 310 scoped_ptr<gfx::SlideAnimation> body_hover_animation_; | 310 std::unique_ptr<gfx::SlideAnimation> body_hover_animation_; |
| 311 scoped_ptr<gfx::SlideAnimation> drop_hover_animation_; | 311 std::unique_ptr<gfx::SlideAnimation> drop_hover_animation_; |
| 312 | 312 |
| 313 // Animation for download complete. | 313 // Animation for download complete. |
| 314 scoped_ptr<gfx::SlideAnimation> complete_animation_; | 314 std::unique_ptr<gfx::SlideAnimation> complete_animation_; |
| 315 | 315 |
| 316 // Progress animation | 316 // Progress animation |
| 317 base::RepeatingTimer progress_timer_; | 317 base::RepeatingTimer progress_timer_; |
| 318 | 318 |
| 319 // Dangerous mode buttons. | 319 // Dangerous mode buttons. |
| 320 views::LabelButton* save_button_; | 320 views::LabelButton* save_button_; |
| 321 views::LabelButton* discard_button_; | 321 views::LabelButton* discard_button_; |
| 322 | 322 |
| 323 // Dangerous mode label. | 323 // Dangerous mode label. |
| 324 views::Label* dangerous_download_label_; | 324 views::Label* dangerous_download_label_; |
| 325 | 325 |
| 326 // Whether the dangerous mode label has been sized yet. | 326 // Whether the dangerous mode label has been sized yet. |
| 327 bool dangerous_download_label_sized_; | 327 bool dangerous_download_label_sized_; |
| 328 | 328 |
| 329 // Whether we are currently disabled as part of opening the downloaded file. | 329 // Whether we are currently disabled as part of opening the downloaded file. |
| 330 bool disabled_while_opening_; | 330 bool disabled_while_opening_; |
| 331 | 331 |
| 332 // The time at which this view was created. | 332 // The time at which this view was created. |
| 333 base::Time creation_time_; | 333 base::Time creation_time_; |
| 334 | 334 |
| 335 // The time at which a dangerous download warning was displayed. | 335 // The time at which a dangerous download warning was displayed. |
| 336 base::Time time_download_warning_shown_; | 336 base::Time time_download_warning_shown_; |
| 337 | 337 |
| 338 // The currently running download context menu. | 338 // The currently running download context menu. |
| 339 scoped_ptr<DownloadShelfContextMenuView> context_menu_; | 339 std::unique_ptr<DownloadShelfContextMenuView> context_menu_; |
| 340 | 340 |
| 341 // The name of this view as reported to assistive technology. | 341 // The name of this view as reported to assistive technology. |
| 342 base::string16 accessible_name_; | 342 base::string16 accessible_name_; |
| 343 | 343 |
| 344 // The icon loaded in the download shelf is based on the file path of the | 344 // The icon loaded in the download shelf is based on the file path of the |
| 345 // item. Store the path used, so that we can detect a change in the path | 345 // item. Store the path used, so that we can detect a change in the path |
| 346 // and reload the icon. | 346 // and reload the icon. |
| 347 base::FilePath last_download_item_path_; | 347 base::FilePath last_download_item_path_; |
| 348 | 348 |
| 349 // ExperienceSampling: This tracks dangerous/malicious downloads warning UI | 349 // ExperienceSampling: This tracks dangerous/malicious downloads warning UI |
| 350 // and the user's decisions about it. | 350 // and the user's decisions about it. |
| 351 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 351 std::unique_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
| 352 | 352 |
| 353 // Method factory used to delay reenabling of the item when opening the | 353 // Method factory used to delay reenabling of the item when opening the |
| 354 // downloaded file. | 354 // downloaded file. |
| 355 base::WeakPtrFactory<DownloadItemView> weak_ptr_factory_; | 355 base::WeakPtrFactory<DownloadItemView> weak_ptr_factory_; |
| 356 | 356 |
| 357 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); | 357 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); |
| 358 }; | 358 }; |
| 359 | 359 |
| 360 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ | 360 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ |
| OLD | NEW |