Chromium Code Reviews| Index: chrome/browser/ui/views/srt_prompt_dialog.h |
| diff --git a/chrome/browser/ui/views/srt_prompt_dialog.h b/chrome/browser/ui/views/srt_prompt_dialog.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4b7e8ba25a5754fd6d006740f2c866e63b7bec75 |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/srt_prompt_dialog.h |
| @@ -0,0 +1,81 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_ |
| +#define CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_ |
| + |
| +#include "base/macros.h" |
| +#include "third_party/skia/include/core/SkColor.h" |
| +#include "ui/gfx/image/image_skia.h" |
| +#include "ui/views/controls/button/button.h" |
| +#include "ui/views/controls/button/label_button.h" |
| +#include "ui/views/window/dialog_delegate.h" |
| + |
| +class Browser; |
| + |
| +namespace safe_browsing { |
| +class SRTPromptController; |
| +} |
| + |
| +// A modal dialog asking the user if they want to run the Chrome Cleanup |
| +// tool. The dialog will have the following sections: |
| +// |
| +// 1. Main section with general information about unwanted software that has |
| +// been found on the user's system. |
| +// 2. Expandable details section with more details about unwanted software that |
| +// will be removed and Chrome settings that will be reset. |
| +// 3. Checkbox asking for permissions to upload logs (not yet implemented). |
| +// |
| +// The strings and icons used in the dialog are provided by a |
| +// |SRTPromptController| object, which will also receive information about how |
| +// the user interacts with the dialog. The controller object owns itself and |
| +// will delete itself once it has received information about the user's |
| +// interaction with the dialog. See the |SRTPromptController| class's |
| +// description for more details. |
| +class SRTPromptDialog : public views::DialogDelegateView, |
|
sky
2017/04/05 21:17:42
Current naming rules suggest this should SrtPrompt
alito
2017/04/06 00:20:22
There is a legacy problem in that we have a lot of
|
| + public views::ButtonListener { |
| + public: |
| + // The |controller| object manages its own lifetime and is not owned by |
|
sky
2017/04/05 21:17:42
If controller manages its own lifetime how do you
alito
2017/04/06 00:20:22
The contract (described by the controller class's
sky
2017/04/06 16:01:02
In that case, it seems you should null out control
alito
2017/04/06 17:35:37
Done.
|
| + // |SRTPromptDialog|. See the description of the |SRTPromptController| class |
| + // for details. |
| + explicit SRTPromptDialog(safe_browsing::SRTPromptController* controller); |
| + ~SRTPromptDialog() override; |
| + |
| + void Show(Browser* browser); |
| + |
| + // ui::DialogModel overrides. |
| + bool ShouldDefaultButtonBeBlue() const override; |
| + |
| + // views::WidgetDelegate overrides. |
| + ui::ModalType GetModalType() const override; |
| + base::string16 GetWindowTitle() const override; |
| + |
| + // views::DialogDelegate overrides. |
| + base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| + bool Accept() override; |
| + bool Cancel() override; |
| + |
| + // views::View overrides. |
| + gfx::Size GetPreferredSize() const override; |
| + |
| + // views::ButtonListener overrides. |
| + void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| + |
| + private: |
| + class ExpandableMessageView; |
| + |
| + Browser* browser_; |
| + safe_browsing::SRTPromptController* controller_; |
| + bool interaction_done_; |
|
sky
2017/04/05 21:17:42
Add description.
alito
2017/04/06 00:20:23
Done.
|
| + |
| + ExpandableMessageView* details_view_; |
| + views::LabelButton* expand_details_button_; |
| + SkColor expand_details_button_color_; |
| + gfx::ImageSkia expand_icon_; |
| + gfx::ImageSkia fold_icon_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SRTPromptDialog); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_ |