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 "ui/views/controls/link_listener.h"
11 #include "ui/views/window/dialog_delegate.h"
23 // Asks the user whether s/he wants to participate in the Safe Browsing
24 // download feedback program. Shown only for downloads marked DANGEROUS_HOST
25 // or UNCOMMON_DOWNLOAD. The user should only see this dialog once.
26 class DownloadFeedbackDialogView
: public views::DialogDelegate
,
27 public views::LinkListener
{
29 // Callback with the user's decision. |accepted| is true if the user clicked
30 // Accept(). Otherwise, assume the user cancelled.
31 typedef base::Callback
<void(bool accepted
)> UserDecisionCallback
;
34 gfx::NativeWindow parent_window
,
36 content::PageNavigator
* navigator
,
37 const UserDecisionCallback
& callback
);
40 DownloadFeedbackDialogView(
42 content::PageNavigator
* navigator
,
43 const UserDecisionCallback
& callback
);
44 ~DownloadFeedbackDialogView() override
;
46 // Handles the user's decision.
47 bool OnButtonClicked(bool accepted
);
49 // views::DialogDelegate:
50 ui::ModalType
GetModalType() const override
;
51 base::string16
GetWindowTitle() const override
;
52 void DeleteDelegate() override
;
53 views::Widget
* GetWidget() override
;
54 const views::Widget
* GetWidget() const override
;
55 views::View
* GetContentsView() override
;
56 int GetDefaultDialogButton() const override
;
57 base::string16
GetDialogButtonLabel(ui::DialogButton button
) const override
;
58 bool Cancel() override
;
59 bool Accept() override
;
60 views::View
* CreateExtraView() override
;
62 // views::LinkListener:
63 void LinkClicked(views::Link
* source
, int event_flags
) override
;
66 content::PageNavigator
* navigator_
;
67 const UserDecisionCallback callback_
;
68 views::MessageBoxView
* explanation_box_view_
;
69 views::Link
* link_view_
;
70 base::string16 title_text_
;
71 base::string16 ok_button_text_
;
72 base::string16 cancel_button_text_
;
74 DISALLOW_COPY_AND_ASSIGN(DownloadFeedbackDialogView
);
77 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_