Chromium Code Reviews| 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. The user should only see this dialog once. | |
| 23 class DownloadFeedbackDialogView : public views::DialogDelegate { | |
| 24 public: | |
| 25 // Possible values for prefs::kSafeBrowsingDownloadReportingEnabled pref. | |
| 26 enum DownloadReportingStatus { | |
| 27 kDialogNotYetShown, | |
| 28 kDownloadReportingDisabled, // Set by Cancel(). | |
| 29 kDownloadReportingEnabled, // Set by Accept(). | |
| 30 kDialogDecisionPending, // When a dialog is open in another window. | |
|
mattm
2014/02/06 23:27:26
A little odd since the pref is never actually set
felt
2014/02/06 23:31:57
There are a few ways to do this:
1. Have the diffe
mattm
2014/02/06 23:44:36
#3 does seem preferable to me from a code readabil
| |
| 31 kMaxValue | |
| 32 }; | |
| 33 | |
| 34 static void Show( | |
| 35 gfx::NativeWindow parent_window, | |
| 36 Profile* profile, | |
| 37 const base::Callback<void(DownloadReportingStatus)>& callback); | |
| 38 | |
| 39 private: | |
| 40 DownloadFeedbackDialogView( | |
| 41 Profile* profile, | |
| 42 const base::Callback<void(DownloadReportingStatus)>& callback); | |
| 43 virtual ~DownloadFeedbackDialogView(); | |
| 44 | |
| 45 // views::DialogDelegate: | |
| 46 virtual ui::ModalType GetModalType() const OVERRIDE; | |
| 47 virtual base::string16 GetWindowTitle() const OVERRIDE; | |
| 48 virtual void DeleteDelegate() OVERRIDE; | |
| 49 virtual views::Widget* GetWidget() OVERRIDE; | |
| 50 virtual const views::Widget* GetWidget() const OVERRIDE; | |
| 51 virtual views::View* GetContentsView() OVERRIDE; | |
| 52 virtual int GetDefaultDialogButton() const OVERRIDE; | |
| 53 virtual base::string16 GetDialogButtonLabel( | |
| 54 ui::DialogButton button) const OVERRIDE; | |
| 55 virtual bool Cancel() OVERRIDE; | |
| 56 virtual bool Accept() OVERRIDE; | |
| 57 | |
| 58 Profile* profile_; | |
| 59 const base::Callback<void(DownloadReportingStatus)> callback_; | |
| 60 views::MessageBoxView* explanation_box_view_; | |
| 61 base::string16 title_text_; | |
| 62 base::string16 ok_button_text_; | |
| 63 base::string16 cancel_button_text_; | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(DownloadFeedbackDialogView); | |
| 66 }; | |
| 67 | |
| 68 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_ | |
| OLD | NEW |