OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_CHROME_CLEANER_DIALOG_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_CHROME_CLEANER_DIALOG_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "ui/views/controls/button/button.h" | 11 #include "ui/views/controls/button/button.h" |
12 #include "ui/views/controls/button/label_button.h" | 12 #include "ui/views/controls/button/label_button.h" |
13 #include "ui/views/window/dialog_delegate.h" | 13 #include "ui/views/window/dialog_delegate.h" |
14 | 14 |
15 class Browser; | 15 class Browser; |
16 | 16 |
17 namespace safe_browsing { | 17 namespace safe_browsing { |
18 class SRTPromptController; | 18 class ChromeCleanerDialogController; |
19 } | 19 } |
20 | 20 |
21 // A modal dialog asking the user if they want to remove harmful software from | 21 // A modal dialog asking the user if they want to remove harmful software from |
22 // their computers by running the Chrome Cleanup tool. | 22 // their computers by running the Chrome Cleanup tool. |
23 // | 23 // |
24 // The strings and icons used in the dialog are provided by a | 24 // The strings and icons used in the dialog are provided by a |
25 // |SRTPromptController| object, which will also receive information about how | 25 // |ChromeCleanerDialogController| object, which will also receive information |
26 // the user interacts with the dialog. The controller object owns itself and | 26 // about how the user interacts with the dialog. The controller object owns |
27 // will delete itself once it has received information about the user's | 27 // itself and will delete itself once it has received information about the |
28 // interaction with the dialog. See the |SRTPromptController| class's | 28 // user's interaction with the dialog. See the |ChromeCleanerDialogController| |
29 // description for more details. | 29 // class's description for more details. |
30 class SRTPromptDialog : public views::DialogDelegateView, | 30 class ChromeCleanerDialog : public views::DialogDelegateView, |
31 public views::ButtonListener { | 31 public views::ButtonListener { |
32 public: | 32 public: |
33 // The |controller| object manages its own lifetime and is not owned by | 33 // The |controller| object manages its own lifetime and is not owned by |
34 // |SRTPromptDialog|. See the description of the |SRTPromptController| class | 34 // |ChromeCleanerDialog|. See the description of the |
35 // for details. | 35 // |ChromeCleanerDialogController| class for details. |
36 explicit SRTPromptDialog(safe_browsing::SRTPromptController* controller); | 36 explicit ChromeCleanerDialog( |
37 ~SRTPromptDialog() override; | 37 safe_browsing::ChromeCleanerDialogController* controller); |
| 38 ~ChromeCleanerDialog() override; |
38 | 39 |
39 void Show(Browser* browser); | 40 void Show(Browser* browser); |
40 | 41 |
41 // ui::DialogModel overrides. | 42 // ui::DialogModel overrides. |
42 bool ShouldDefaultButtonBeBlue() const override; | 43 bool ShouldDefaultButtonBeBlue() const override; |
43 | 44 |
44 // views::WidgetDelegate overrides. | 45 // views::WidgetDelegate overrides. |
45 ui::ModalType GetModalType() const override; | 46 ui::ModalType GetModalType() const override; |
46 base::string16 GetWindowTitle() const override; | 47 base::string16 GetWindowTitle() const override; |
47 | 48 |
48 // views::DialogDelegate overrides. | 49 // views::DialogDelegate overrides. |
49 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 50 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
50 views::View* CreateExtraView() override; | 51 views::View* CreateExtraView() override; |
51 bool Accept() override; | 52 bool Accept() override; |
52 bool Cancel() override; | 53 bool Cancel() override; |
53 bool Close() override; | 54 bool Close() override; |
54 | 55 |
55 // views::View overrides. | 56 // views::View overrides. |
56 gfx::Size GetPreferredSize() const override; | 57 gfx::Size GetPreferredSize() const override; |
57 | 58 |
58 // views::ButtonListener overrides. | 59 // views::ButtonListener overrides. |
59 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 60 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
60 | 61 |
61 private: | 62 private: |
62 Browser* browser_; | 63 Browser* browser_; |
63 // The pointer will be set to nullptr once the controller has been notified of | 64 // The pointer will be set to nullptr once the controller has been notified of |
64 // user interaction since the controller can delete itself after that point. | 65 // user interaction since the controller can delete itself after that point. |
65 safe_browsing::SRTPromptController* controller_; | 66 safe_browsing::ChromeCleanerDialogController* controller_; |
66 | 67 |
67 views::LabelButton* advanced_button_; | 68 views::LabelButton* advanced_button_; |
68 | 69 |
69 DISALLOW_COPY_AND_ASSIGN(SRTPromptDialog); | 70 DISALLOW_COPY_AND_ASSIGN(ChromeCleanerDialog); |
70 }; | 71 }; |
71 | 72 |
72 #endif // CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_ | 73 #endif // CHROME_BROWSER_UI_VIEWS_CHROME_CLEANER_DIALOG_H_ |
OLD | NEW |