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 "base/macros.h" |
| 9 #include "third_party/skia/include/core/SkColor.h" |
| 10 #include "ui/gfx/image/image_skia.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 run the Chrome Cleanup |
| 22 // tool. The dialog will have the following sections: |
| 23 // |
| 24 // 1. Main section with general information about unwanted software that has |
| 25 // been found on the user's system. |
| 26 // 2. Expandable details section with more details about unwanted software that |
| 27 // will be removed and Chrome settings that will be reset. |
| 28 // 3. Checkbox asking for permissions to upload logs (not yet implemented). |
| 29 // |
| 30 // The strings and icons used in the dialog are provided by a |
| 31 // |SRTPromptController| object, which will also receive information about how |
| 32 // the user interacts with the dialog. The controller object owns itself and |
| 33 // will delete itself once it has received information about the user's |
| 34 // interaction with the dialog. See the |SRTPromptController| class's |
| 35 // description for more details. |
| 36 class SRTPromptDialog : public views::DialogDelegateView, |
| 37 public views::ButtonListener { |
| 38 public: |
| 39 // The |controller| object manages its own lifetime and is not owned by |
| 40 // |SRTPromptDialog|. See the description of the |SRTPromptController| class |
| 41 // for details. |
| 42 explicit SRTPromptDialog(safe_browsing::SRTPromptController* controller); |
| 43 ~SRTPromptDialog() override; |
| 44 |
| 45 void Show(Browser* browser); |
| 46 |
| 47 // ui::DialogModel overrides. |
| 48 bool ShouldDefaultButtonBeBlue() const override; |
| 49 |
| 50 // views::WidgetDelegate overrides. |
| 51 ui::ModalType GetModalType() const override; |
| 52 base::string16 GetWindowTitle() const override; |
| 53 |
| 54 // views::DialogDelegate overrides. |
| 55 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 56 bool Accept() override; |
| 57 bool Cancel() override; |
| 58 |
| 59 // views::View overrides. |
| 60 gfx::Size GetPreferredSize() const override; |
| 61 |
| 62 // views::ButtonListener overrides. |
| 63 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 64 |
| 65 private: |
| 66 SkColor GetDetailsButtonColor(); |
| 67 void UpdateDetailsButton(); |
| 68 |
| 69 Browser* browser_; |
| 70 // The pointer will be set to nullptr once the controller has been notified of |
| 71 // user interaction since the controller can delete itself after that point. |
| 72 safe_browsing::SRTPromptController* controller_; |
| 73 |
| 74 views::View* details_view_; |
| 75 views::LabelButton* details_button_; |
| 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(SRTPromptDialog); |
| 78 }; |
| 79 |
| 80 #endif // CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_ |
OLD | NEW |