[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / download / download_feedback_dialog_view.h
blob95da725904df0e1c658fa3ec46a83f11098639e4
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/window/dialog_delegate.h"
13 namespace views {
14 class MessageBoxView;
17 class Profile;
19 // Asks the user whether s/he wants to participate in the Safe Browsing
20 // download feedback program. Shown only for downloads marked DANGEROUS_HOST
21 // or UNCOMMON_DOWNLOAD. The user should only see this dialog once.
22 class DownloadFeedbackDialogView : public views::DialogDelegate {
23 public:
24 // Callback with the user's decision. |accepted| is true if the user clicked
25 // Accept(). Otherwise, assume the user cancelled.
26 typedef base::Callback<void(bool accepted)> UserDecisionCallback;
28 static void Show(
29 gfx::NativeWindow parent_window,
30 Profile* profile,
31 const UserDecisionCallback& callback);
33 private:
34 DownloadFeedbackDialogView(
35 Profile* profile,
36 const UserDecisionCallback& callback);
37 virtual ~DownloadFeedbackDialogView();
39 // Handles the user's decision.
40 bool OnButtonClicked(bool accepted);
42 // views::DialogDelegate:
43 virtual ui::ModalType GetModalType() const OVERRIDE;
44 virtual base::string16 GetWindowTitle() const OVERRIDE;
45 virtual void DeleteDelegate() OVERRIDE;
46 virtual views::Widget* GetWidget() OVERRIDE;
47 virtual const views::Widget* GetWidget() const OVERRIDE;
48 virtual views::View* GetContentsView() OVERRIDE;
49 virtual int GetDefaultDialogButton() const OVERRIDE;
50 virtual base::string16 GetDialogButtonLabel(
51 ui::DialogButton button) const OVERRIDE;
52 virtual bool Cancel() OVERRIDE;
53 virtual bool Accept() OVERRIDE;
55 Profile* profile_;
56 const UserDecisionCallback callback_;
57 views::MessageBoxView* explanation_box_view_;
58 base::string16 title_text_;
59 base::string16 ok_button_text_;
60 base::string16 cancel_button_text_;
62 DISALLOW_COPY_AND_ASSIGN(DownloadFeedbackDialogView);
65 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_FEEDBACK_DIALOG_VIEW_H_