Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Unified Diff: chrome/browser/ui/views/download/download_feedback_dialog_view.h

Issue 147593002: Implement new dangerous download reporting dialog for UNCOMMON_DOWNLOAD, in Views (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..c69a666c1a8dcd8e27fcd9b516c93a2d0f52520f
--- /dev/null
+++ b/chrome/browser/ui/views/download/download_feedback_dialog_view.h
@@ -0,0 +1,67 @@
+// 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. 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.
+class DownloadFeedbackDialogView : public views::DialogDelegate {
+ public:
+ // 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.
+ 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.
+ kNeverShown,
Peter Kasting 2014/02/04 21:56:33 Nit: kDialogNotYetShown?
felt 2014/02/04 23:37:22 Done.
+ 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.
+ kUserEnabled, // Set by Accept().
+ kMaxValue
+ };
+
+ static void Show(gfx::NativeWindow parent_window,
+ Profile* profile,
+ const base::Callback<void(bool)>& callback);
+
+ private:
+ DownloadFeedbackDialogView(Profile* profile,
+ const base::Callback<void(bool)>& callback);
+ virtual ~DownloadFeedbackDialogView();
+
+ // views::DialogDelegate:
+ virtual int GetDefaultDialogButton() const OVERRIDE;
+ virtual base::string16 GetDialogButtonLabel(
+ ui::DialogButton button) const OVERRIDE;
+ virtual bool Cancel() OVERRIDE;
+ virtual bool Accept() OVERRIDE;
+
+ // 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.
+ 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;
+
+ Profile* profile_;
+ const base::Callback<void(bool)> 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_

Powered by Google App Engine
This is Rietveld 408576698