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

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: First version for review 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..e4c097d87798b902108de54e0ba702cabc5be53b 100644
--- a/chrome/browser/ui/views/download/download_feedback_dialog_view.cc
+++ b/chrome/browser/ui/views/download/download_feedback_dialog_view.cc
@@ -13,6 +13,8 @@
#include "ui/views/controls/message_box_view.h"
#include "ui/views/widget/widget.h"
+using safe_browsing::DownloadFeedbackService;
+
namespace {
const void* kDialogStatusKey = &kDialogStatusKey;
@@ -33,10 +35,12 @@ 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(DownloadFeedbackService::DownloadReportingStatus)>& callback) {
// This dialog should only be shown if it hasn't been shown before.
- DCHECK(profile->GetPrefs()->GetInteger(
- prefs::kSafeBrowsingDownloadReportingEnabled) == kDialogNotYetShown);
+ DCHECK_EQ(DownloadFeedbackService::kDialogNotYetShown,
+ profile->GetPrefs()->GetInteger(
+ prefs::kSafeBrowsingDownloadReportingEnabled));
// 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 +57,7 @@ void DownloadFeedbackDialogView::Show(
new DownloadFeedbackDialogView(profile, callback);
CreateBrowserModalDialogViews(window, parent_window)->Show();
} else {
- callback.Run(kDownloadReportingDisabled);
+ callback.Run(DownloadFeedbackService::kDownloadReportingDisabled);
}
}
@@ -66,7 +70,8 @@ void DownloadFeedbackDialogView::ReleaseDialogStatusHold() {
DownloadFeedbackDialogView::DownloadFeedbackDialogView(
Profile* profile,
- const base::Callback<void(DownloadReportingStatus)>& callback)
+ const base::Callback<void(
+ DownloadFeedbackService::DownloadReportingStatus)>& callback)
: profile_(profile),
callback_(callback),
explanation_box_view_(new views::MessageBoxView(
@@ -93,17 +98,19 @@ base::string16 DownloadFeedbackDialogView::GetDialogButtonLabel(
bool DownloadFeedbackDialogView::Cancel() {
profile_->GetPrefs()->SetInteger(
- prefs::kSafeBrowsingDownloadReportingEnabled, kDownloadReportingDisabled);
+ prefs::kSafeBrowsingDownloadReportingEnabled,
+ DownloadFeedbackService::kDownloadReportingDisabled);
ReleaseDialogStatusHold();
- callback_.Run(kDownloadReportingDisabled);
+ callback_.Run(DownloadFeedbackService::kDownloadReportingDisabled);
return true;
}
bool DownloadFeedbackDialogView::Accept() {
profile_->GetPrefs()->SetInteger(
- prefs::kSafeBrowsingDownloadReportingEnabled, kDownloadReportingEnabled);
+ prefs::kSafeBrowsingDownloadReportingEnabled,
+ DownloadFeedbackService::kDownloadReportingEnabled);
ReleaseDialogStatusHold();
- callback_.Run(kDownloadReportingEnabled);
+ callback_.Run(DownloadFeedbackService::kDownloadReportingEnabled);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698