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

Unified Diff: chrome/browser/ui/views/download/download_feedback_dialog_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_feedback_dialog_view.cc
diff --git a/chrome/browser/ui/views/download/download_feedback_dialog_view.cc b/chrome/browser/ui/views/download/download_feedback_dialog_view.cc
index 00774ad9b4c2aea926d6ab5f409c4f204f39b83a..37786e1174e849f2ac3dcf59ba7909c839599ba4 100644
--- a/chrome/browser/ui/views/download/download_feedback_dialog_view.cc
+++ b/chrome/browser/ui/views/download/download_feedback_dialog_view.cc
@@ -33,10 +33,10 @@ class DialogStatusData : public base::SupportsUserData::Data {
void DownloadFeedbackDialogView::Show(
gfx::NativeWindow parent_window,
Profile* profile,
- const base::Callback<void(DownloadReportingStatus)>& callback) {
+ const base::Callback<void(bool)>& callback) {
// This dialog should only be shown if it hasn't been shown before.
- DCHECK(profile->GetPrefs()->GetInteger(
- prefs::kSafeBrowsingDownloadReportingEnabled) == kDialogNotYetShown);
+ DCHECK(!profile->GetPrefs()->HasPrefPath(
+ prefs::kSafeBrowsingDownloadFeedbackEnabled));
// Only one dialog should be shown at a time, so check to see if another one
// is open. If another one is open, treat this parallel call as if reporting
@@ -53,7 +53,7 @@ void DownloadFeedbackDialogView::Show(
new DownloadFeedbackDialogView(profile, callback);
CreateBrowserModalDialogViews(window, parent_window)->Show();
} else {
- callback.Run(kDownloadReportingDisabled);
+ callback.Run(false /* disabled */);
Peter Kasting 2014/02/13 22:17:52 Nit: Don't add these sorts of parameter-explaining
felt 2014/02/14 00:21:49 Done, added typedef for the callback.
}
}
@@ -66,7 +66,7 @@ void DownloadFeedbackDialogView::ReleaseDialogStatusHold() {
DownloadFeedbackDialogView::DownloadFeedbackDialogView(
Profile* profile,
- const base::Callback<void(DownloadReportingStatus)>& callback)
+ const base::Callback<void(bool)>& callback)
: profile_(profile),
callback_(callback),
explanation_box_view_(new views::MessageBoxView(
@@ -92,18 +92,18 @@ base::string16 DownloadFeedbackDialogView::GetDialogButtonLabel(
}
bool DownloadFeedbackDialogView::Cancel() {
- profile_->GetPrefs()->SetInteger(
- prefs::kSafeBrowsingDownloadReportingEnabled, kDownloadReportingDisabled);
+ profile_->GetPrefs()->SetBoolean(prefs::kSafeBrowsingDownloadFeedbackEnabled,
+ false);
ReleaseDialogStatusHold();
- callback_.Run(kDownloadReportingDisabled);
+ callback_.Run(false /* disabled */);
return true;
Peter Kasting 2014/02/13 22:17:52 Nit: Because the bodies of these two functions are
felt 2014/02/14 00:21:49 Done. Also merged ReleaseDialogStatusHold into the
}
bool DownloadFeedbackDialogView::Accept() {
- profile_->GetPrefs()->SetInteger(
- prefs::kSafeBrowsingDownloadReportingEnabled, kDownloadReportingEnabled);
+ profile_->GetPrefs()->SetBoolean(prefs::kSafeBrowsingDownloadFeedbackEnabled,
+ true);
ReleaseDialogStatusHold();
- callback_.Run(kDownloadReportingEnabled);
+ callback_.Run(true /* enabled */);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698