| 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_SRT_PROMPT_DIALOG_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "third_party/skia/include/core/SkColor.h" | |
| 12 #include "ui/gfx/animation/animation_delegate.h" | |
| 13 #include "ui/gfx/image/image_skia.h" | |
| 14 #include "ui/views/controls/button/button.h" | 11 #include "ui/views/controls/button/button.h" |
| 15 #include "ui/views/controls/button/label_button.h" | 12 #include "ui/views/controls/button/label_button.h" |
| 16 #include "ui/views/window/dialog_delegate.h" | 13 #include "ui/views/window/dialog_delegate.h" |
| 17 | 14 |
| 18 class Browser; | 15 class Browser; |
| 19 | 16 |
| 20 namespace gfx { | |
| 21 class SlideAnimation; | |
| 22 } | |
| 23 | |
| 24 namespace safe_browsing { | 17 namespace safe_browsing { |
| 25 class SRTPromptController; | 18 class SRTPromptController; |
| 26 } | 19 } |
| 27 | 20 |
| 28 // A modal dialog asking the user if they want to run the Chrome Cleanup | 21 // A modal dialog asking the user if they want to remove harmful software from |
| 29 // tool. The dialog will have the following sections: | 22 // their computers by running the Chrome Cleanup tool. |
| 30 // | |
| 31 // 1. Main section with general information about unwanted software that has | |
| 32 // been found on the user's system. | |
| 33 // 2. Expandable details section with more details about unwanted software that | |
| 34 // will be removed and Chrome settings that will be reset. | |
| 35 // 3. Checkbox asking for permissions to upload logs (not yet implemented). | |
| 36 // | 23 // |
| 37 // 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 |
| 38 // |SRTPromptController| object, which will also receive information about how | 25 // |SRTPromptController| object, which will also receive information about how |
| 39 // the user interacts with the dialog. The controller object owns itself and | 26 // the user interacts with the dialog. The controller object owns itself and |
| 40 // will delete itself once it has received information about the user's | 27 // will delete itself once it has received information about the user's |
| 41 // interaction with the dialog. See the |SRTPromptController| class's | 28 // interaction with the dialog. See the |SRTPromptController| class's |
| 42 // description for more details. | 29 // description for more details. |
| 43 class SRTPromptDialog : public views::DialogDelegateView, | 30 class SRTPromptDialog : public views::DialogDelegateView, |
| 44 public views::ButtonListener, | 31 public views::ButtonListener { |
| 45 public gfx::AnimationDelegate { | |
| 46 public: | 32 public: |
| 47 // 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 |
| 48 // |SRTPromptDialog|. See the description of the |SRTPromptController| class | 34 // |SRTPromptDialog|. See the description of the |SRTPromptController| class |
| 49 // for details. | 35 // for details. |
| 50 explicit SRTPromptDialog(safe_browsing::SRTPromptController* controller); | 36 explicit SRTPromptDialog(safe_browsing::SRTPromptController* controller); |
| 51 ~SRTPromptDialog() override; | 37 ~SRTPromptDialog() override; |
| 52 | 38 |
| 53 void Show(Browser* browser); | 39 void Show(Browser* browser); |
| 54 | 40 |
| 55 // ui::DialogModel overrides. | 41 // ui::DialogModel overrides. |
| 56 bool ShouldDefaultButtonBeBlue() const override; | 42 bool ShouldDefaultButtonBeBlue() const override; |
| 57 | 43 |
| 58 // views::WidgetDelegate overrides. | 44 // views::WidgetDelegate overrides. |
| 59 ui::ModalType GetModalType() const override; | 45 ui::ModalType GetModalType() const override; |
| 60 base::string16 GetWindowTitle() const override; | 46 base::string16 GetWindowTitle() const override; |
| 61 | 47 |
| 62 // views::DialogDelegate overrides. | 48 // views::DialogDelegate overrides. |
| 63 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 49 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 50 views::View* CreateExtraView() override; |
| 64 bool Accept() override; | 51 bool Accept() override; |
| 65 bool Cancel() override; | 52 bool Cancel() override; |
| 53 bool Close() override; |
| 66 | 54 |
| 67 // views::View overrides. | 55 // views::View overrides. |
| 68 gfx::Size GetPreferredSize() const override; | 56 gfx::Size GetPreferredSize() const override; |
| 69 | 57 |
| 70 // views::ButtonListener overrides. | 58 // views::ButtonListener overrides. |
| 71 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 59 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 72 | 60 |
| 73 // gfx::AnimationDelegate overrides. | |
| 74 void AnimationProgressed(const gfx::Animation* animation) override; | |
| 75 void AnimationEnded(const gfx::Animation* animation) override; | |
| 76 | |
| 77 private: | 61 private: |
| 78 class ExpandableMessageView; | |
| 79 | |
| 80 SkColor GetDetailsButtonColor(); | |
| 81 void UpdateDetailsButton(); | |
| 82 | |
| 83 Browser* browser_; | 62 Browser* browser_; |
| 84 // The pointer will be set to nullptr once the controller has been notified of | 63 // The pointer will be set to nullptr once the controller has been notified of |
| 85 // user interaction since the controller can delete itself after that point. | 64 // user interaction since the controller can delete itself after that point. |
| 86 safe_browsing::SRTPromptController* controller_; | 65 safe_browsing::SRTPromptController* controller_; |
| 87 | 66 |
| 88 std::unique_ptr<gfx::SlideAnimation> slide_animation_; | 67 views::LabelButton* advanced_button_; |
| 89 ExpandableMessageView* details_view_; | |
| 90 views::LabelButton* details_button_; | |
| 91 | 68 |
| 92 DISALLOW_COPY_AND_ASSIGN(SRTPromptDialog); | 69 DISALLOW_COPY_AND_ASSIGN(SRTPromptDialog); |
| 93 }; | 70 }; |
| 94 | 71 |
| 95 #endif // CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_ | 72 #endif // CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_ |
| OLD | NEW |