OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "chrome/browser/ui/browser.h" | |
11 #include "chrome/common/pref_names.h" | |
12 #include "ui/views/window/dialog_delegate.h" | |
13 | |
14 namespace views { | |
15 class MessageBoxView; | |
16 } | |
17 | |
18 class Profile; | |
19 | |
20 // Asks the user whether s/he wants to participate in the Safe Browsing | |
21 // download feedback program. Shown only for downloads marked DANGEROUS_HOST | |
22 // or UNCOMMON_DOWNLOAD. User should only see this dialog once! | |
Peter Kasting
2014/02/04 21:56:33
Nit: User -> The user
I would probably avoid the
felt
2014/02/04 23:37:22
Done.
Peter Kasting
2014/02/05 19:47:08
Tiny nit: It still just says "User".
felt
2014/02/05 19:57:26
Done.
| |
23 class DownloadFeedbackDialogView : public views::DialogDelegate { | |
24 public: | |
25 // Used to set prefs::kSafeBrowsingDownloadReportingEnabled. | |
Peter Kasting
2014/02/04 21:56:33
Nit: "Possible values for the kSafeBrowsingDownloa
felt
2014/02/04 23:37:22
Done.
Peter Kasting
2014/02/05 19:47:08
Not really... there's now just an added "pref" at
felt
2014/02/05 19:57:26
Done.
| |
26 enum Response { | |
Peter Kasting
2014/02/04 21:56:33
Nit: Since not all of these are responses, what ab
felt
2014/02/04 23:37:22
Done.
| |
27 kNeverShown, | |
Peter Kasting
2014/02/04 21:56:33
Nit: kDialogNotYetShown?
felt
2014/02/04 23:37:22
Done.
| |
28 kUserDisabled, // Set by Show() as a default. | |
Peter Kasting
2014/02/04 21:56:33
Nit: kDownloadReportingEnabled? (And similarly wi
felt
2014/02/04 23:37:22
Done.
| |
29 kUserEnabled, // Set by Accept(). | |
30 kMaxValue | |
31 }; | |
32 | |
33 static void Show(gfx::NativeWindow parent_window, | |
34 Profile* profile, | |
35 const base::Callback<void(bool)>& callback); | |
36 | |
37 private: | |
38 DownloadFeedbackDialogView(Profile* profile, | |
39 const base::Callback<void(bool)>& callback); | |
40 virtual ~DownloadFeedbackDialogView(); | |
41 | |
42 // views::DialogDelegate: | |
43 virtual int GetDefaultDialogButton() const OVERRIDE; | |
44 virtual base::string16 GetDialogButtonLabel( | |
45 ui::DialogButton button) const OVERRIDE; | |
46 virtual bool Cancel() OVERRIDE; | |
47 virtual bool Accept() OVERRIDE; | |
48 | |
49 // views::WidgetDelegate: | |
Peter Kasting
2014/02/04 21:56:33
Nit: You don't directly subclass WidgetDelegate.
felt
2014/02/04 23:37:22
Done.
| |
50 virtual ui::ModalType GetModalType() const OVERRIDE; | |
51 virtual base::string16 GetWindowTitle() const OVERRIDE; | |
52 virtual void DeleteDelegate() OVERRIDE; | |
53 virtual views::Widget* GetWidget() OVERRIDE; | |
54 virtual const views::Widget* GetWidget() const OVERRIDE; | |
55 virtual views::View* GetContentsView() OVERRIDE; | |
56 | |
57 Profile* profile_; | |
58 const base::Callback<void(bool)> callback_; | |
59 views::MessageBoxView* explanation_box_view_; | |
60 base::string16 title_text_; | |
61 base::string16 ok_button_text_; | |
62 base::string16 cancel_button_text_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(DownloadFeedbackDialogView); | |
65 }; | |
66 | |
67 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_ | |
OLD | NEW |