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