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

Side by Side Diff: chrome/browser/ui/views/download/download_feedback_dialog_view.cc

Issue 163433012: Add a histogram "Download.FeedbackDialogEnabled" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/views/download/download_feedback_dialog_view.h" 5 #include "chrome/browser/ui/views/download/download_feedback_dialog_view.h"
6 6
7 #include "base/metrics/histogram.h"
7 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
8 #include "base/supports_user_data.h" 9 #include "base/supports_user_data.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/views/constrained_window_views.h" 11 #include "chrome/browser/ui/views/constrained_window_views.h"
11 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
12 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/views/controls/message_box_view.h" 14 #include "ui/views/controls/message_box_view.h"
14 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
15 16
16 namespace { 17 namespace {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 86 }
86 87
87 bool DownloadFeedbackDialogView::OnButtonClicked(bool accepted) { 88 bool DownloadFeedbackDialogView::OnButtonClicked(bool accepted) {
88 profile_->GetPrefs()->SetBoolean(prefs::kSafeBrowsingDownloadFeedbackEnabled, 89 profile_->GetPrefs()->SetBoolean(prefs::kSafeBrowsingDownloadFeedbackEnabled,
89 accepted); 90 accepted);
90 DialogStatusData* data = 91 DialogStatusData* data =
91 static_cast<DialogStatusData*>(profile_->GetUserData(kDialogStatusKey)); 92 static_cast<DialogStatusData*>(profile_->GetUserData(kDialogStatusKey));
92 DCHECK(data); 93 DCHECK(data);
93 data->set_currently_shown(false); 94 data->set_currently_shown(false);
94 95
96 UMA_HISTOGRAM_BOOLEAN("Download.FeedbackDialogEnabled", accepted);
97
95 callback_.Run(accepted); 98 callback_.Run(accepted);
96 return true; 99 return true;
97 } 100 }
98 101
99 bool DownloadFeedbackDialogView::Cancel() { 102 bool DownloadFeedbackDialogView::Cancel() {
100 return OnButtonClicked(false); 103 return OnButtonClicked(false);
101 } 104 }
102 105
103 bool DownloadFeedbackDialogView::Accept() { 106 bool DownloadFeedbackDialogView::Accept() {
104 return OnButtonClicked(true); 107 return OnButtonClicked(true);
(...skipping 15 matching lines...) Expand all
120 return explanation_box_view_->GetWidget(); 123 return explanation_box_view_->GetWidget();
121 } 124 }
122 125
123 const views::Widget* DownloadFeedbackDialogView::GetWidget() const { 126 const views::Widget* DownloadFeedbackDialogView::GetWidget() const {
124 return explanation_box_view_->GetWidget(); 127 return explanation_box_view_->GetWidget();
125 } 128 }
126 129
127 views::View* DownloadFeedbackDialogView::GetContentsView() { 130 views::View* DownloadFeedbackDialogView::GetContentsView() {
128 return explanation_box_view_; 131 return explanation_box_view_;
129 } 132 }
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698