| 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 #include "chrome/browser/ui/gtk/download/download_item_gtk.h" | 5 #include "chrome/browser/ui/gtk/download/download_item_gtk.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 15 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 16 #include "chrome/browser/download/download_item_model.h" | 16 #include "chrome/browser/download/download_item_model.h" |
| 17 #include "chrome/browser/download/download_util.h" | 17 #include "chrome/browser/download/download_util.h" |
| 18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/gtk/custom_drag.h" | 19 #include "chrome/browser/ui/gtk/custom_drag.h" |
| 20 #include "chrome/browser/ui/gtk/download/download_shelf_context_menu_gtk.h" | 20 #include "chrome/browser/ui/gtk/download/download_shelf_context_menu_gtk.h" |
| 21 #include "chrome/browser/ui/gtk/download/download_shelf_gtk.h" | 21 #include "chrome/browser/ui/gtk/download/download_shelf_gtk.h" |
| 22 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 22 #include "chrome/browser/ui/gtk/gtk_util.h" | 23 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 23 #include "chrome/browser/ui/gtk/nine_box.h" | 24 #include "chrome/browser/ui/gtk/nine_box.h" |
| 24 #include "chrome/browser/ui/gtk/theme_service_gtk.h" | |
| 25 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
| 26 #include "content/public/browser/download_manager.h" | 26 #include "content/public/browser/download_manager.h" |
| 27 #include "content/public/browser/notification_source.h" | 27 #include "content/public/browser/notification_source.h" |
| 28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 29 #include "grit/theme_resources.h" | 29 #include "grit/theme_resources.h" |
| 30 #include "third_party/skia/include/core/SkBitmap.h" | 30 #include "third_party/skia/include/core/SkBitmap.h" |
| 31 #include "ui/base/animation/slide_animation.h" | 31 #include "ui/base/animation/slide_animation.h" |
| 32 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
| 33 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
| 34 #include "ui/base/text/text_elider.h" | 34 #include "ui/base/text/text_elider.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 NineBox* DownloadItemGtk::dangerous_nine_box_ = NULL; | 102 NineBox* DownloadItemGtk::dangerous_nine_box_ = NULL; |
| 103 | 103 |
| 104 using content::DownloadItem; | 104 using content::DownloadItem; |
| 105 | 105 |
| 106 DownloadItemGtk::DownloadItemGtk(DownloadShelfGtk* parent_shelf, | 106 DownloadItemGtk::DownloadItemGtk(DownloadShelfGtk* parent_shelf, |
| 107 BaseDownloadItemModel* download_model) | 107 BaseDownloadItemModel* download_model) |
| 108 : parent_shelf_(parent_shelf), | 108 : parent_shelf_(parent_shelf), |
| 109 arrow_(NULL), | 109 arrow_(NULL), |
| 110 menu_showing_(false), | 110 menu_showing_(false), |
| 111 theme_service_( | 111 theme_service_( |
| 112 ThemeServiceGtk::GetFrom(parent_shelf->browser()->profile())), | 112 GtkThemeService::GetFrom(parent_shelf->browser()->profile())), |
| 113 progress_angle_(download_util::kStartAngleDegrees), | 113 progress_angle_(download_util::kStartAngleDegrees), |
| 114 download_model_(download_model), | 114 download_model_(download_model), |
| 115 dangerous_prompt_(NULL), | 115 dangerous_prompt_(NULL), |
| 116 dangerous_label_(NULL), | 116 dangerous_label_(NULL), |
| 117 complete_animation_(this), | 117 complete_animation_(this), |
| 118 icon_small_(NULL), | 118 icon_small_(NULL), |
| 119 icon_large_(NULL), | 119 icon_large_(NULL), |
| 120 creation_time_(base::Time::Now()), | 120 creation_time_(base::Time::Now()), |
| 121 download_complete_(false), | 121 download_complete_(false), |
| 122 disabled_while_opening_(false), | 122 disabled_while_opening_(false), |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 get_download()->DangerousDownloadValidated(); | 917 get_download()->DangerousDownloadValidated(); |
| 918 } | 918 } |
| 919 | 919 |
| 920 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { | 920 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button) { |
| 921 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", | 921 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", |
| 922 base::Time::Now() - creation_time_); | 922 base::Time::Now() - creation_time_); |
| 923 if (get_download()->IsPartialDownload()) | 923 if (get_download()->IsPartialDownload()) |
| 924 get_download()->Cancel(true); | 924 get_download()->Cancel(true); |
| 925 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 925 get_download()->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); |
| 926 } | 926 } |
| OLD | NEW |