Commit f8f753f6 authored by alito's avatar alito Committed by Commit bot

Chrome Cleaner UI: Rename SRT to ChromeCleaner

BUG=690020

patch from issue 2847643002 at patchset 20001 (http://crrev.com/2847643002#ps20001)

Review-Url: https://codereview.chromium.org/2848683002
Cr-Commit-Position: refs/heads/master@{#468169}
parent b784ef49
......@@ -1785,6 +1785,8 @@ split_static_library("browser") {
"renderer_context_menu/context_menu_content_type_platform_app.h",
"renderer_host/chrome_extension_message_filter.cc",
"renderer_host/chrome_extension_message_filter.h",
"safe_browsing/chrome_cleaner_dialog_controller.cc",
"safe_browsing/chrome_cleaner_dialog_controller.h",
"safe_browsing/settings_reset_prompt/extension_info.cc",
"safe_browsing/settings_reset_prompt/extension_info.h",
"safe_browsing/settings_reset_prompt/settings_reset_prompt_config.cc",
......@@ -1795,8 +1797,6 @@ split_static_library("browser") {
"safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h",
"safe_browsing/settings_reset_prompt/settings_reset_prompt_prefs_manager.cc",
"safe_browsing/settings_reset_prompt/settings_reset_prompt_prefs_manager.h",
"safe_browsing/srt_prompt_controller.cc",
"safe_browsing/srt_prompt_controller.h",
"search/hotword_audio_history_handler.cc",
"search/hotword_audio_history_handler.h",
"search/hotword_client.h",
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/safe_browsing/srt_prompt_controller.h"
#include "chrome/browser/safe_browsing/chrome_cleaner_dialog_controller.h"
#include "base/strings/utf_string_conversions.h"
......@@ -22,45 +22,45 @@ constexpr char kAdvancedButtonLabel[] = "Advanced";
} // namespace
SRTPromptController::SRTPromptController() {}
ChromeCleanerDialogController::ChromeCleanerDialogController() {}
SRTPromptController::~SRTPromptController() = default;
ChromeCleanerDialogController::~ChromeCleanerDialogController() = default;
base::string16 SRTPromptController::GetWindowTitle() const {
base::string16 ChromeCleanerDialogController::GetWindowTitle() const {
return base::UTF8ToUTF16(kWindowTitle);
}
base::string16 SRTPromptController::GetMainText() const {
base::string16 ChromeCleanerDialogController::GetMainText() const {
return base::UTF8ToUTF16(kMainText);
}
base::string16 SRTPromptController::GetAcceptButtonLabel() const {
base::string16 ChromeCleanerDialogController::GetAcceptButtonLabel() const {
return base::UTF8ToUTF16(kAcceptButtonLabel);
}
base::string16 SRTPromptController::GetAdvancedButtonLabel() const {
base::string16 ChromeCleanerDialogController::GetAdvancedButtonLabel() const {
return base::UTF8ToUTF16(kAdvancedButtonLabel);
}
void SRTPromptController::DialogShown() {}
void ChromeCleanerDialogController::DialogShown() {}
void SRTPromptController::Accept() {
void ChromeCleanerDialogController::Accept() {
OnInteractionDone();
}
void SRTPromptController::Cancel() {
void ChromeCleanerDialogController::Cancel() {
OnInteractionDone();
}
void SRTPromptController::Close() {
void ChromeCleanerDialogController::Close() {
OnInteractionDone();
}
void SRTPromptController::AdvancedButtonClicked() {
void ChromeCleanerDialogController::AdvancedButtonClicked() {
OnInteractionDone();
}
void SRTPromptController::OnInteractionDone() {
void ChromeCleanerDialogController::OnInteractionDone() {
delete this;
}
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SAFE_BROWSING_SRT_PROMPT_CONTROLLER_H_
#define CHROME_BROWSER_SAFE_BROWSING_SRT_PROMPT_CONTROLLER_H_
#ifndef CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_DIALOG_CONTROLLER_H_
#define CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_DIALOG_CONTROLLER_H_
#include <vector>
......@@ -19,9 +19,9 @@ namespace safe_browsing {
// This class manages its own lifetime and will delete itself once the Cleaner
// dialog has been dismissed and either of |Accept()| or |Cancel()| have been
// called.
class SRTPromptController {
class ChromeCleanerDialogController {
public:
SRTPromptController();
ChromeCleanerDialogController();
base::string16 GetWindowTitle() const;
base::string16 GetMainText() const;
......@@ -52,14 +52,14 @@ class SRTPromptController {
void AdvancedButtonClicked();
protected:
~SRTPromptController();
~ChromeCleanerDialogController();
private:
void OnInteractionDone();
DISALLOW_COPY_AND_ASSIGN(SRTPromptController);
DISALLOW_COPY_AND_ASSIGN(ChromeCleanerDialogController);
};
} // namespace safe_browsing
#endif // CHROME_BROWSER_SAFE_BROWSING_SRT_PROMPT_CONTROLLER_H_
#endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_DIALOG_CONTROLLER_H_
......@@ -3061,6 +3061,8 @@ split_static_library("ui") {
"input_method/input_method_engine_base.h",
"network_profile_bubble.cc",
"network_profile_bubble.h",
"views/chrome_cleaner_dialog.cc",
"views/chrome_cleaner_dialog.h",
"views/color_chooser_dialog.cc",
"views/color_chooser_dialog.h",
"views/critical_notification_bubble_view.cc",
......@@ -3078,8 +3080,6 @@ split_static_library("ui") {
"views/network_profile_bubble_view.cc",
"views/settings_reset_prompt_dialog.cc",
"views/settings_reset_prompt_dialog.h",
"views/srt_prompt_dialog.cc",
"views/srt_prompt_dialog.h",
"views/uninstall_view.cc",
"views/uninstall_view.h",
"webui/cleanup_tool/cleanup_action_handler.cc",
......
......@@ -56,7 +56,7 @@ class PaymentRequestDialog;
}
namespace safe_browsing {
class SRTPromptController;
class ChromeCleanerDialogController;
}
namespace security_state {
......@@ -244,8 +244,9 @@ void RecordDialogCreation(DialogIdentifier identifier);
// Shows the Chrome Cleanup dialog asking the user if they want to clean their
// system from unwanted software. This is called when unwanted software has been
// detected on the system.
void ShowSRTPrompt(Browser* browser,
safe_browsing::SRTPromptController* controller);
void ShowChromeCleanerPrompt(
Browser* browser,
safe_browsing::ChromeCleanerDialogController* controller);
#endif // OS_WIN
......
......@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/srt_prompt_dialog.h"
#include "chrome/browser/ui/views/chrome_cleaner_dialog.h"
#include "base/strings/string16.h"
#include "chrome/browser/safe_browsing/srt_prompt_controller.h"
#include "chrome/browser/safe_browsing/chrome_cleaner_dialog_controller.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_window.h"
......@@ -21,9 +21,10 @@
namespace chrome {
void ShowSRTPrompt(Browser* browser,
safe_browsing::SRTPromptController* controller) {
SRTPromptDialog* dialog = new SRTPromptDialog(controller);
void ShowChromeCleanerPrompt(
Browser* browser,
safe_browsing::ChromeCleanerDialogController* controller) {
ChromeCleanerDialog* dialog = new ChromeCleanerDialog(controller);
dialog->Show(browser);
}
......@@ -34,9 +35,10 @@ constexpr int kDialogWidth = 448;
} // namespace
////////////////////////////////////////////////////////////////////////////////
// SRTPromptDialog
// ChromeCleanerDialog
SRTPromptDialog::SRTPromptDialog(safe_browsing::SRTPromptController* controller)
ChromeCleanerDialog::ChromeCleanerDialog(
safe_browsing::ChromeCleanerDialogController* controller)
: browser_(nullptr),
controller_(controller),
advanced_button_(
......@@ -56,14 +58,14 @@ SRTPromptDialog::SRTPromptDialog(safe_browsing::SRTPromptController* controller)
advanced_button_->SetStyle(views::Button::STYLE_BUTTON);
}
SRTPromptDialog::~SRTPromptDialog() {
ChromeCleanerDialog::~ChromeCleanerDialog() {
// Make sure the controller is correctly notified in case the dialog widget is
// closed by some other means than the dialog buttons.
if (controller_)
controller_->Cancel();
}
void SRTPromptDialog::Show(Browser* browser) {
void ChromeCleanerDialog::Show(Browser* browser) {
DCHECK(browser);
DCHECK(!browser_);
DCHECK(controller_);
......@@ -77,24 +79,24 @@ void SRTPromptDialog::Show(Browser* browser) {
// DialogModel overrides.
bool SRTPromptDialog::ShouldDefaultButtonBeBlue() const {
bool ChromeCleanerDialog::ShouldDefaultButtonBeBlue() const {
return true;
}
// WidgetDelegate overrides.
ui::ModalType SRTPromptDialog::GetModalType() const {
ui::ModalType ChromeCleanerDialog::GetModalType() const {
return ui::MODAL_TYPE_WINDOW;
}
base::string16 SRTPromptDialog::GetWindowTitle() const {
base::string16 ChromeCleanerDialog::GetWindowTitle() const {
DCHECK(controller_);
return controller_->GetWindowTitle();
}
// DialogDelegate overrides.
base::string16 SRTPromptDialog::GetDialogButtonLabel(
base::string16 ChromeCleanerDialog::GetDialogButtonLabel(
ui::DialogButton button) const {
DCHECK(button == ui::DIALOG_BUTTON_OK || button == ui::DIALOG_BUTTON_CANCEL);
DCHECK(controller_);
......@@ -104,11 +106,11 @@ base::string16 SRTPromptDialog::GetDialogButtonLabel(
: DialogDelegate::GetDialogButtonLabel(button);
}
views::View* SRTPromptDialog::CreateExtraView() {
views::View* ChromeCleanerDialog::CreateExtraView() {
return advanced_button_;
}
bool SRTPromptDialog::Accept() {
bool ChromeCleanerDialog::Accept() {
if (controller_) {
controller_->Accept();
controller_ = nullptr;
......@@ -116,7 +118,7 @@ bool SRTPromptDialog::Accept() {
return true;
}
bool SRTPromptDialog::Cancel() {
bool ChromeCleanerDialog::Cancel() {
if (controller_) {
controller_->Cancel();
controller_ = nullptr;
......@@ -124,7 +126,7 @@ bool SRTPromptDialog::Cancel() {
return true;
}
bool SRTPromptDialog::Close() {
bool ChromeCleanerDialog::Close() {
if (controller_) {
controller_->Close();
controller_ = nullptr;
......@@ -134,14 +136,14 @@ bool SRTPromptDialog::Close() {
// View overrides.
gfx::Size SRTPromptDialog::GetPreferredSize() const {
gfx::Size ChromeCleanerDialog::GetPreferredSize() const {
return gfx::Size(kDialogWidth, GetHeightForWidth(kDialogWidth));
}
// views::ButtonListener overrides.
void SRTPromptDialog::ButtonPressed(views::Button* sender,
const ui::Event& event) {
void ChromeCleanerDialog::ButtonPressed(views::Button* sender,
const ui::Event& event) {
DCHECK_EQ(sender, advanced_button_);
DCHECK(browser_);
......
......@@ -2,8 +2,8 @@
// 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_
#ifndef CHROME_BROWSER_UI_VIEWS_CHROME_CLEANER_DIALOG_H_
#define CHROME_BROWSER_UI_VIEWS_CHROME_CLEANER_DIALOG_H_
#include <memory>
......@@ -15,26 +15,27 @@
class Browser;
namespace safe_browsing {
class SRTPromptController;
class ChromeCleanerDialogController;
}
// A modal dialog asking the user if they want to remove harmful software from
// their computers by running the Chrome Cleanup tool.
//
// 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,
public views::ButtonListener {
// |ChromeCleanerDialogController| 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 |ChromeCleanerDialogController|
// class's description for more details.
class ChromeCleanerDialog : public views::DialogDelegateView,
public views::ButtonListener {
public:
// The |controller| object manages its own lifetime and is not owned by
// |SRTPromptDialog|. See the description of the |SRTPromptController| class
// for details.
explicit SRTPromptDialog(safe_browsing::SRTPromptController* controller);
~SRTPromptDialog() override;
// |ChromeCleanerDialog|. See the description of the
// |ChromeCleanerDialogController| class for details.
explicit ChromeCleanerDialog(
safe_browsing::ChromeCleanerDialogController* controller);
~ChromeCleanerDialog() override;
void Show(Browser* browser);
......@@ -62,11 +63,11 @@ class SRTPromptDialog : public views::DialogDelegateView,
Browser* browser_;
// The pointer will be set to nullptr once the controller has been notified of
// user interaction since the controller can delete itself after that point.
safe_browsing::SRTPromptController* controller_;
safe_browsing::ChromeCleanerDialogController* controller_;
views::LabelButton* advanced_button_;
DISALLOW_COPY_AND_ASSIGN(SRTPromptDialog);
DISALLOW_COPY_AND_ASSIGN(ChromeCleanerDialog);
};
#endif // CHROME_BROWSER_UI_VIEWS_SRT_PROMPT_DIALOG_H_
#endif // CHROME_BROWSER_UI_VIEWS_CHROME_CLEANER_DIALOG_H_
......@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/srt_prompt_dialog.h"
#include "chrome/browser/ui/views/chrome_cleaner_dialog.h"
#include "base/macros.h"
#include "chrome/browser/safe_browsing/srt_prompt_controller.h"
#include "chrome/browser/safe_browsing/chrome_cleaner_dialog_controller.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/test/test_browser_dialog.h"
......@@ -15,19 +15,20 @@
namespace {
class SRTPromptDialogTest : public DialogBrowserTest {
class ChromeCleanerDialogTest : public DialogBrowserTest {
public:
SRTPromptDialogTest() {}
ChromeCleanerDialogTest() {}
void ShowDialog(const std::string& name) override {
chrome::ShowSRTPrompt(browser(), new safe_browsing::SRTPromptController());
chrome::ShowChromeCleanerPrompt(
browser(), new safe_browsing::ChromeCleanerDialogController());
}
private:
DISALLOW_COPY_AND_ASSIGN(SRTPromptDialogTest);
DISALLOW_COPY_AND_ASSIGN(ChromeCleanerDialogTest);
};
IN_PROC_BROWSER_TEST_F(SRTPromptDialogTest, InvokeDialog_default) {
IN_PROC_BROWSER_TEST_F(ChromeCleanerDialogTest, InvokeDialog_default) {
RunDialog();
}
......
......@@ -2400,8 +2400,8 @@ test("browser_tests") {
if (is_win) {
sources += [
"../browser/extensions/api/networking_private/networking_private_credentials_getter_browsertest.cc",
"../browser/ui/views/chrome_cleaner_dialog_browsertest.cc",
"../browser/ui/views/settings_reset_prompt_dialog_browsertest.cc",
"../browser/ui/views/srt_prompt_dialog_browsertest.cc",
]
}
if (is_mac || is_win) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment