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 kMaxValue |
| 31 }; |
| 32 |
| 33 static void Show( |
| 34 gfx::NativeWindow parent_window, |
| 35 Profile* profile, |
| 36 const base::Callback<void(DownloadReportingStatus)>& callback); |
| 37 |
| 38 private: |
| 39 DownloadFeedbackDialogView( |
| 40 Profile* profile, |
| 41 const base::Callback<void(DownloadReportingStatus)>& callback); |
| 42 virtual ~DownloadFeedbackDialogView(); |
| 43 |
| 44 // views::DialogDelegate: |
| 45 virtual ui::ModalType GetModalType() const OVERRIDE; |
| 46 virtual base::string16 GetWindowTitle() const OVERRIDE; |
| 47 virtual void DeleteDelegate() OVERRIDE; |
| 48 virtual views::Widget* GetWidget() OVERRIDE; |
| 49 virtual const views::Widget* GetWidget() const OVERRIDE; |
| 50 virtual views::View* GetContentsView() OVERRIDE; |
| 51 virtual int GetDefaultDialogButton() const OVERRIDE; |
| 52 virtual base::string16 GetDialogButtonLabel( |
| 53 ui::DialogButton button) const OVERRIDE; |
| 54 virtual bool Cancel() OVERRIDE; |
| 55 virtual bool Accept() OVERRIDE; |
| 56 |
| 57 Profile* profile_; |
| 58 const base::Callback<void(DownloadReportingStatus)> 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 |