Privacy policy links for extended safe browsing reporting
[chromium-blink-merge.git] / chrome / browser / ui / views / download / download_feedback_dialog_view.h
blobeaa8e877a85e34b0db12a6e47980072e2efa0538
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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "chrome/common/pref_names.h"
11 #include "ui/views/controls/link_listener.h"
12 #include "ui/views/window/dialog_delegate.h"
14 namespace views {
15 class MessageBoxView;
18 namespace content {
19 class PageNavigator;
22 class Profile;
24 // Asks the user whether s/he wants to participate in the Safe Browsing
25 // download feedback program. Shown only for downloads marked DANGEROUS_HOST
26 // or UNCOMMON_DOWNLOAD. The user should only see this dialog once.
27 class DownloadFeedbackDialogView : public views::DialogDelegate,
28 public views::LinkListener {
29 public:
30 // Callback with the user's decision. |accepted| is true if the user clicked
31 // Accept(). Otherwise, assume the user cancelled.
32 typedef base::Callback<void(bool accepted)> UserDecisionCallback;
34 static void Show(
35 gfx::NativeWindow parent_window,
36 Profile* profile,
37 content::PageNavigator* navigator,
38 const UserDecisionCallback& callback);
40 private:
41 DownloadFeedbackDialogView(
42 Profile* profile,
43 content::PageNavigator* navigator,
44 const UserDecisionCallback& callback);
45 virtual ~DownloadFeedbackDialogView();
47 // Handles the user's decision.
48 bool OnButtonClicked(bool accepted);
50 // views::DialogDelegate:
51 virtual ui::ModalType GetModalType() const OVERRIDE;
52 virtual base::string16 GetWindowTitle() const OVERRIDE;
53 virtual void DeleteDelegate() OVERRIDE;
54 virtual views::Widget* GetWidget() OVERRIDE;
55 virtual const views::Widget* GetWidget() const OVERRIDE;
56 virtual views::View* GetContentsView() OVERRIDE;
57 virtual int GetDefaultDialogButton() const OVERRIDE;
58 virtual base::string16 GetDialogButtonLabel(
59 ui::DialogButton button) const OVERRIDE;
60 virtual bool Cancel() OVERRIDE;
61 virtual bool Accept() OVERRIDE;
62 virtual views::View* CreateExtraView() OVERRIDE;
64 // views::LinkListener:
65 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
67 Profile* profile_;
68 content::PageNavigator* navigator_;
69 const UserDecisionCallback callback_;
70 views::MessageBoxView* explanation_box_view_;
71 views::Link* link_view_;
72 base::string16 title_text_;
73 base::string16 ok_button_text_;
74 base::string16 cancel_button_text_;
76 DISALLOW_COPY_AND_ASSIGN(DownloadFeedbackDialogView);
79 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_