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

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

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 unified diff | Download patch
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 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "chrome/browser/safe_browsing/download_feedback_service.h"
10 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
11 #include "ui/views/window/dialog_delegate.h" 12 #include "ui/views/window/dialog_delegate.h"
12 13
13 namespace views { 14 namespace views {
14 class MessageBoxView; 15 class MessageBoxView;
15 } 16 }
16 17
17 class Profile; 18 class Profile;
18 19
20 using safe_browsing::DownloadFeedbackService;
21
19 // Asks the user whether s/he wants to participate in the Safe Browsing 22 // Asks the user whether s/he wants to participate in the Safe Browsing
20 // download feedback program. Shown only for downloads marked DANGEROUS_HOST 23 // download feedback program. Shown only for downloads marked DANGEROUS_HOST
21 // or UNCOMMON_DOWNLOAD. The user should only see this dialog once. 24 // or UNCOMMON_DOWNLOAD. The user should only see this dialog once.
22 class DownloadFeedbackDialogView : public views::DialogDelegate { 25 class DownloadFeedbackDialogView : public views::DialogDelegate {
23 public: 26 public:
24 // Possible values for prefs::kSafeBrowsingDownloadReportingEnabled pref.
25 enum DownloadReportingStatus {
26 kDialogNotYetShown,
27 kDownloadReportingDisabled, // Set by Cancel().
28 kDownloadReportingEnabled, // Set by Accept().
29 kMaxValue
30 };
31
32 static void Show( 27 static void Show(
33 gfx::NativeWindow parent_window, 28 gfx::NativeWindow parent_window,
34 Profile* profile, 29 Profile* profile,
35 const base::Callback<void(DownloadReportingStatus)>& callback); 30 const base::Callback<void(
31 DownloadFeedbackService::DownloadReportingStatus)>& callback);
36 32
37 private: 33 private:
38 DownloadFeedbackDialogView( 34 DownloadFeedbackDialogView(
39 Profile* profile, 35 Profile* profile,
40 const base::Callback<void(DownloadReportingStatus)>& callback); 36 const base::Callback<void(
37 DownloadFeedbackService::DownloadReportingStatus)>& callback);
41 virtual ~DownloadFeedbackDialogView(); 38 virtual ~DownloadFeedbackDialogView();
42 39
43 void ReleaseDialogStatusHold(); 40 void ReleaseDialogStatusHold();
44 41
45 // views::DialogDelegate: 42 // views::DialogDelegate:
46 virtual ui::ModalType GetModalType() const OVERRIDE; 43 virtual ui::ModalType GetModalType() const OVERRIDE;
47 virtual base::string16 GetWindowTitle() const OVERRIDE; 44 virtual base::string16 GetWindowTitle() const OVERRIDE;
48 virtual void DeleteDelegate() OVERRIDE; 45 virtual void DeleteDelegate() OVERRIDE;
49 virtual views::Widget* GetWidget() OVERRIDE; 46 virtual views::Widget* GetWidget() OVERRIDE;
50 virtual const views::Widget* GetWidget() const OVERRIDE; 47 virtual const views::Widget* GetWidget() const OVERRIDE;
51 virtual views::View* GetContentsView() OVERRIDE; 48 virtual views::View* GetContentsView() OVERRIDE;
52 virtual int GetDefaultDialogButton() const OVERRIDE; 49 virtual int GetDefaultDialogButton() const OVERRIDE;
53 virtual base::string16 GetDialogButtonLabel( 50 virtual base::string16 GetDialogButtonLabel(
54 ui::DialogButton button) const OVERRIDE; 51 ui::DialogButton button) const OVERRIDE;
55 virtual bool Cancel() OVERRIDE; 52 virtual bool Cancel() OVERRIDE;
56 virtual bool Accept() OVERRIDE; 53 virtual bool Accept() OVERRIDE;
57 54
58 Profile* profile_; 55 Profile* profile_;
59 const base::Callback<void(DownloadReportingStatus)> callback_; 56 const base::Callback<void(
57 DownloadFeedbackService::DownloadReportingStatus)> callback_;
60 views::MessageBoxView* explanation_box_view_; 58 views::MessageBoxView* explanation_box_view_;
61 base::string16 title_text_; 59 base::string16 title_text_;
62 base::string16 ok_button_text_; 60 base::string16 ok_button_text_;
63 base::string16 cancel_button_text_; 61 base::string16 cancel_button_text_;
64 62
65 DISALLOW_COPY_AND_ASSIGN(DownloadFeedbackDialogView); 63 DISALLOW_COPY_AND_ASSIGN(DownloadFeedbackDialogView);
66 }; 64 };
67 65
68 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_ 66 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698