Index: chrome/browser/ui/views/download/download_feedback_dialog_view.h |
diff --git a/chrome/browser/ui/views/download/download_feedback_dialog_view.h b/chrome/browser/ui/views/download/download_feedback_dialog_view.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0adf980aa7553e9a4247e305b160a3b55a066ae8 |
--- /dev/null |
+++ b/chrome/browser/ui/views/download/download_feedback_dialog_view.h |
@@ -0,0 +1,68 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_ |
+#define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "chrome/browser/ui/browser.h" |
+#include "chrome/common/pref_names.h" |
+#include "ui/views/window/dialog_delegate.h" |
+ |
+namespace views { |
+class MessageBoxView; |
+} |
+ |
+class Profile; |
+ |
+// Asks the user whether s/he wants to participate in the Safe Browsing |
+// download feedback program. Shown only for downloads marked DANGEROUS_HOST |
+// or UNCOMMON_DOWNLOAD. The user should only see this dialog once. |
+class DownloadFeedbackDialogView : public views::DialogDelegate { |
+ public: |
+ // Possible values for prefs::kSafeBrowsingDownloadReportingEnabled pref. |
+ enum DownloadReportingStatus { |
+ kDialogNotYetShown, |
+ kDownloadReportingDisabled, // Set by Cancel(). |
+ kDownloadReportingEnabled, // Set by Accept(). |
+ 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
|
+ kMaxValue |
+ }; |
+ |
+ static void Show( |
+ gfx::NativeWindow parent_window, |
+ Profile* profile, |
+ const base::Callback<void(DownloadReportingStatus)>& callback); |
+ |
+ private: |
+ DownloadFeedbackDialogView( |
+ Profile* profile, |
+ const base::Callback<void(DownloadReportingStatus)>& callback); |
+ virtual ~DownloadFeedbackDialogView(); |
+ |
+ // views::DialogDelegate: |
+ virtual ui::ModalType GetModalType() const OVERRIDE; |
+ virtual base::string16 GetWindowTitle() const OVERRIDE; |
+ virtual void DeleteDelegate() OVERRIDE; |
+ virtual views::Widget* GetWidget() OVERRIDE; |
+ virtual const views::Widget* GetWidget() const OVERRIDE; |
+ virtual views::View* GetContentsView() OVERRIDE; |
+ virtual int GetDefaultDialogButton() const OVERRIDE; |
+ virtual base::string16 GetDialogButtonLabel( |
+ ui::DialogButton button) const OVERRIDE; |
+ virtual bool Cancel() OVERRIDE; |
+ virtual bool Accept() OVERRIDE; |
+ |
+ Profile* profile_; |
+ const base::Callback<void(DownloadReportingStatus)> callback_; |
+ views::MessageBoxView* explanation_box_view_; |
+ base::string16 title_text_; |
+ base::string16 ok_button_text_; |
+ base::string16 cancel_button_text_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DownloadFeedbackDialogView); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_ |