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/common/pref_names.h" |
| 11 #include "ui/views/window/dialog_delegate.h" |
| 12 |
| 13 namespace views { |
| 14 class MessageBoxView; |
| 15 } |
| 16 |
| 17 class Profile; |
| 18 |
| 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 |
| 21 // or UNCOMMON_DOWNLOAD. The user should only see this dialog once. |
| 22 class DownloadFeedbackDialogView : public views::DialogDelegate { |
| 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( |
| 33 gfx::NativeWindow parent_window, |
| 34 Profile* profile, |
| 35 const base::Callback<void(DownloadReportingStatus)>& callback); |
| 36 |
| 37 private: |
| 38 DownloadFeedbackDialogView( |
| 39 Profile* profile, |
| 40 const base::Callback<void(DownloadReportingStatus)>& callback); |
| 41 virtual ~DownloadFeedbackDialogView(); |
| 42 |
| 43 void ReleaseDialogStatusHold(); |
| 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 |