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