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