OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 view that implements one download on the Download shelf. | 5 // A view that implements one download on the Download shelf. |
6 // Each DownloadItemViewMd contains an application icon, a text label | 6 // Each DownloadItemViewMd 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. |
(...skipping 17 matching lines...) Expand all Loading... |
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" |
33 #include "ui/gfx/font_list.h" | 33 #include "ui/gfx/font_list.h" |
34 #include "ui/views/animation/ink_drop_host_view.h" | 34 #include "ui/views/animation/ink_drop_host_view.h" |
35 #include "ui/views/context_menu_controller.h" | 35 #include "ui/views/context_menu_controller.h" |
36 #include "ui/views/controls/button/button.h" | 36 #include "ui/views/controls/button/button.h" |
37 | 37 |
38 class BarControlButton; | |
39 class DownloadShelfView; | 38 class DownloadShelfView; |
40 class DownloadShelfContextMenuView; | 39 class DownloadShelfContextMenuView; |
41 | 40 |
42 namespace extensions { | 41 namespace extensions { |
43 class ExperienceSamplingEvent; | 42 class ExperienceSamplingEvent; |
44 } | 43 } |
45 | 44 |
46 namespace gfx { | 45 namespace gfx { |
47 class Image; | 46 class Image; |
48 class ImageSkia; | 47 class ImageSkia; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void AnimationProgressed(const gfx::Animation* animation) override; | 124 void AnimationProgressed(const gfx::Animation* animation) override; |
126 | 125 |
127 protected: | 126 protected: |
128 // Overridden from views::View: | 127 // Overridden from views::View: |
129 void OnPaint(gfx::Canvas* canvas) override; | 128 void OnPaint(gfx::Canvas* canvas) override; |
130 void OnFocus() override; | 129 void OnFocus() override; |
131 void OnBlur() override; | 130 void OnBlur() override; |
132 | 131 |
133 private: | 132 private: |
134 enum State { NORMAL = 0, HOT, PUSHED }; | 133 enum State { NORMAL = 0, HOT, PUSHED }; |
| 134 class DropDownButton; |
135 | 135 |
136 enum Mode { | 136 enum Mode { |
137 NORMAL_MODE = 0, // Showing download item. | 137 NORMAL_MODE = 0, // Showing download item. |
138 DANGEROUS_MODE, // Displaying the dangerous download warning. | 138 DANGEROUS_MODE, // Displaying the dangerous download warning. |
139 MALICIOUS_MODE // Displaying the malicious download warning. | 139 MALICIOUS_MODE // Displaying the malicious download warning. |
140 }; | 140 }; |
141 | 141 |
142 void OpenDownload(); | 142 void OpenDownload(); |
143 | 143 |
144 // Submits the downloaded file to the safebrowsing download feedback service. | 144 // Submits the downloaded file to the safebrowsing download feedback service. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 // For canceling an in progress icon request. | 273 // For canceling an in progress icon request. |
274 base::CancelableTaskTracker cancelable_task_tracker_; | 274 base::CancelableTaskTracker cancelable_task_tracker_; |
275 | 275 |
276 // A model class to control the status text we display. | 276 // A model class to control the status text we display. |
277 DownloadItemModel model_; | 277 DownloadItemModel model_; |
278 | 278 |
279 // Animation for download complete. | 279 // Animation for download complete. |
280 std::unique_ptr<gfx::SlideAnimation> complete_animation_; | 280 std::unique_ptr<gfx::SlideAnimation> complete_animation_; |
281 | 281 |
282 // A pointer to the InkDropDelegate owned by the base class InkDropHostView. | |
283 // This is kept as a ButtonInkDropDelegate pointer to avoid unnecessary casts. | |
284 // TODO(bruthig): Remove the need to cast and remove the | |
285 // |button_ink_drop_delegate_| variable. | |
286 views::ButtonInkDropDelegate* button_ink_drop_delegate_; | |
287 | |
288 // Progress animation | 282 // Progress animation |
289 base::RepeatingTimer progress_timer_; | 283 base::RepeatingTimer progress_timer_; |
290 | 284 |
291 // Dangerous mode buttons. | 285 // Dangerous mode buttons. |
292 views::LabelButton* save_button_; | 286 views::LabelButton* save_button_; |
293 views::LabelButton* discard_button_; | 287 views::LabelButton* discard_button_; |
294 | 288 |
295 // The drop down button. | 289 // The drop down button. |
296 BarControlButton* dropdown_button_; | 290 DropDownButton* dropdown_button_; |
297 | 291 |
298 // Dangerous mode label. | 292 // Dangerous mode label. |
299 views::Label* dangerous_download_label_; | 293 views::Label* dangerous_download_label_; |
300 | 294 |
301 // Whether the dangerous mode label has been sized yet. | 295 // Whether the dangerous mode label has been sized yet. |
302 bool dangerous_download_label_sized_; | 296 bool dangerous_download_label_sized_; |
303 | 297 |
304 // Whether we are currently disabled as part of opening the downloaded file. | 298 // Whether we are currently disabled as part of opening the downloaded file. |
305 bool disabled_while_opening_; | 299 bool disabled_while_opening_; |
306 | 300 |
(...skipping 19 matching lines...) Expand all Loading... |
326 std::unique_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 320 std::unique_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
327 | 321 |
328 // Method factory used to delay reenabling of the item when opening the | 322 // Method factory used to delay reenabling of the item when opening the |
329 // downloaded file. | 323 // downloaded file. |
330 base::WeakPtrFactory<DownloadItemViewMd> weak_ptr_factory_; | 324 base::WeakPtrFactory<DownloadItemViewMd> weak_ptr_factory_; |
331 | 325 |
332 DISALLOW_COPY_AND_ASSIGN(DownloadItemViewMd); | 326 DISALLOW_COPY_AND_ASSIGN(DownloadItemViewMd); |
333 }; | 327 }; |
334 | 328 |
335 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_MD_H_ | 329 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_MD_H_ |
OLD | NEW |