Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Unified Diff: chrome/browser/ui/views/download/download_item_view.cc

Issue 153353006: Opt out of download feedback from settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some cleanup Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/download/download_item_view.cc
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index 7a3d9714d3579f82928cb477f823f410e53a0554..e93b5eb0b2ccac72f64bf1c547e79274479b1f5c 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -557,27 +557,19 @@ void DownloadItemView::ButtonPressed(views::Button* sender,
UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", warning_duration);
if (model_.ShouldAllowDownloadFeedback() &&
!shelf_->browser()->profile()->IsOffTheRecord()) {
- DownloadFeedbackDialogView::DownloadReportingStatus pref_value =
- static_cast<DownloadFeedbackDialogView::DownloadReportingStatus>(
- shelf_->browser()->profile()->GetPrefs()->GetInteger(
- prefs::kSafeBrowsingDownloadReportingEnabled));
- switch (pref_value) {
- case DownloadFeedbackDialogView::kDialogNotYetShown:
- DownloadFeedbackDialogView::Show(
- shelf_->get_parent()->GetNativeWindow(),
- shelf_->browser()->profile(),
- base::Bind(
- &DownloadItemView::PossiblySubmitDownloadToFeedbackService,
- weak_ptr_factory_.GetWeakPtr()));
- break;
-
- case DownloadFeedbackDialogView::kDownloadReportingEnabled:
- case DownloadFeedbackDialogView::kDownloadReportingDisabled:
- PossiblySubmitDownloadToFeedbackService(pref_value);
- break;
-
- case DownloadFeedbackDialogView::kMaxValue:
- NOTREACHED();
+ if (!shelf_->browser()->profile()->GetPrefs()->HasPrefPath(
+ prefs::kSafeBrowsingDownloadFeedbackEnabled)) {
+ // Show dialog, because the dialog hasn't been shown before.
+ DownloadFeedbackDialogView::Show(
+ shelf_->get_parent()->GetNativeWindow(),
+ shelf_->browser()->profile(),
+ base::Bind(
+ &DownloadItemView::PossiblySubmitDownloadToFeedbackService,
+ weak_ptr_factory_.GetWeakPtr()));
+ } else {
+ PossiblySubmitDownloadToFeedbackService(
+ shelf_->browser()->profile()->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingDownloadFeedbackEnabled));
}
return;
}
@@ -937,12 +929,9 @@ bool DownloadItemView::SubmitDownloadToFeedbackService() {
#endif
}
-void DownloadItemView::PossiblySubmitDownloadToFeedbackService(
- DownloadFeedbackDialogView::DownloadReportingStatus status) {
- if (status != DownloadFeedbackDialogView::kDownloadReportingEnabled ||
- !SubmitDownloadToFeedbackService()) {
+void DownloadItemView::PossiblySubmitDownloadToFeedbackService(bool enabled) {
+ if (!enabled || !SubmitDownloadToFeedbackService())
download()->Remove();
- }
// WARNING: 'this' is deleted at this point. Don't access 'this'.
}

Powered by Google App Engine
This is Rietveld 408576698