Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5272)

Unified Diff: chrome/browser/ui/webui/settings/reset_profile_settings_handler.cc

Issue 1418803004: MD Settings: Migrating C++ handlers for profile reset page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unused Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/settings/reset_profile_settings_handler.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/reset_profile_settings_handler.cc
diff --git a/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc b/chrome/browser/ui/webui/settings/reset_profile_settings_handler.cc
similarity index 61%
copy from chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
copy to chrome/browser/ui/webui/settings/reset_profile_settings_handler.cc
index f8503024eef5c363f4e4259a6df50961dccaa0cc..5fabfa341bbc2701d24e616cdbb892717216c9e1 100644
--- a/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/reset_profile_settings_handler.cc
@@ -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/ui/webui/options/reset_profile_settings_handler.h"
+#include "chrome/browser/ui/webui/settings/reset_profile_settings_handler.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -30,98 +30,26 @@
#include "chrome/browser/profile_resetter/triggered_profile_resetter_factory.h"
#endif // defined(OS_WIN)
-namespace options {
+namespace settings {
-ResetProfileSettingsHandler::ResetProfileSettingsHandler()
+ResetProfileSettingsHandler::ResetProfileSettingsHandler(content::WebUI* web_ui)
: automatic_profile_resetter_(NULL),
has_shown_confirmation_dialog_(false) {
google_brand::GetBrand(&brandcode_);
-}
-
-ResetProfileSettingsHandler::~ResetProfileSettingsHandler() {}
-
-void ResetProfileSettingsHandler::InitializeHandler() {
- Profile* profile = Profile::FromWebUI(web_ui());
+ Profile* profile = Profile::FromWebUI(web_ui);
resetter_.reset(new ProfileResetter(profile));
automatic_profile_resetter_ =
AutomaticProfileResetterFactory::GetForBrowserContext(profile);
}
-void ResetProfileSettingsHandler::InitializePage() {
- web_ui()->CallJavascriptFunction(
- "ResetProfileSettingsOverlay.setResettingState",
- base::FundamentalValue(resetter_->IsActive()));
- if (automatic_profile_resetter_ &&
- automatic_profile_resetter_->ShouldShowResetBanner()) {
- web_ui()->CallJavascriptFunction("ResetProfileSettingsBanner.show");
Dan Beam 2015/11/06 23:52:23 so this seems to re-show the banner on refresh. d
dpapad 2015/11/07 00:31:08 I have removed anything related to the banner unti
- }
-}
-
-void ResetProfileSettingsHandler::Uninitialize() {
+ResetProfileSettingsHandler::~ResetProfileSettingsHandler() {
if (has_shown_confirmation_dialog_ && automatic_profile_resetter_) {
automatic_profile_resetter_->NotifyDidCloseWebUIResetDialog(
false /*performed_reset*/);
}
}
-void ResetProfileSettingsHandler::GetLocalizedValues(
- base::DictionaryValue* localized_strings) {
- DCHECK(localized_strings);
-
- static OptionsStringResource resources[] = {
- { "resetProfileSettingsBannerText",
- IDS_RESET_PROFILE_SETTINGS_BANNER_TEXT },
- { "resetProfileSettingsCommit", IDS_RESET_PROFILE_SETTINGS_COMMIT_BUTTON },
- { "resetProfileSettingsExplanation",
- IDS_RESET_PROFILE_SETTINGS_EXPLANATION },
- { "resetProfileSettingsFeedback", IDS_RESET_PROFILE_SETTINGS_FEEDBACK }
- };
-
- RegisterStrings(localized_strings, resources, arraysize(resources));
- RegisterTitle(localized_strings, "resetProfileSettingsOverlay",
- IDS_RESET_PROFILE_SETTINGS_TITLE);
- localized_strings->SetString(
- "resetProfileSettingsLearnMoreUrl",
- chrome::kResetProfileSettingsLearnMoreURL);
-
- // Set up the localized strings for the triggered profile reset overlay.
- // The reset tool name can currently only have a custom value on Windows.
- base::string16 reset_tool_name;
-#if defined(OS_WIN)
- Profile* profile = Profile::FromWebUI(web_ui());
- TriggeredProfileResetter* triggered_profile_resetter =
- TriggeredProfileResetterFactory::GetForBrowserContext(profile);
- // TriggeredProfileResetter instance will be nullptr for incognito profiles.
- if (triggered_profile_resetter)
- reset_tool_name = triggered_profile_resetter->GetResetToolName();
-#endif
-
- if (reset_tool_name.empty()) {
- reset_tool_name = l10n_util::GetStringUTF16(
- IDS_TRIGGERED_RESET_PROFILE_SETTINGS_DEFAULT_TOOL_NAME);
- }
- localized_strings->SetString(
- "triggeredResetProfileSettingsOverlay",
- l10n_util::GetStringFUTF16(IDS_TRIGGERED_RESET_PROFILE_SETTINGS_TITLE,
- reset_tool_name));
- // Set the title manually since RegisterTitle() wants an id.
- base::string16 title_string(l10n_util::GetStringFUTF16(
- IDS_TRIGGERED_RESET_PROFILE_SETTINGS_TITLE, reset_tool_name));
- localized_strings->SetString("triggeredResetProfileSettingsOverlay",
- title_string);
- localized_strings->SetString(
- "triggeredResetProfileSettingsOverlayTabTitle",
- l10n_util::GetStringFUTF16(IDS_OPTIONS_TAB_TITLE,
- l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE),
- title_string));
- localized_strings->SetString(
- "triggeredResetProfileSettingsExplanation",
- l10n_util::GetStringFUTF16(
- IDS_TRIGGERED_RESET_PROFILE_SETTINGS_EXPLANATION, reset_tool_name));
-}
-
void ResetProfileSettingsHandler::RegisterMessages() {
- // Setup handlers specific to this panel.
web_ui()->RegisterMessageCallback("performResetProfileSettings",
base::Bind(&ResetProfileSettingsHandler::HandleResetProfileSettings,
base::Unretained(this)));
@@ -131,10 +59,6 @@ void ResetProfileSettingsHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("onHideResetProfileDialog",
base::Bind(&ResetProfileSettingsHandler::OnHideResetProfileDialog,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("onDismissedResetProfileSettingsBanner",
- base::Bind(&ResetProfileSettingsHandler::
- OnDismissedResetProfileSettingsBanner,
- base::Unretained(this)));
}
void ResetProfileSettingsHandler::HandleResetProfileSettings(
@@ -157,7 +81,7 @@ void ResetProfileSettingsHandler::HandleResetProfileSettings(
void ResetProfileSettingsHandler::OnResetProfileSettingsDone(
bool send_feedback) {
- web_ui()->CallJavascriptFunction("ResetProfileSettingsOverlay.doneResetting");
+ web_ui()->CallJavascriptFunction("SettingsResetPage.doneResetting");
if (send_feedback && setting_snapshot_) {
Profile* profile = Profile::FromWebUI(web_ui());
ResettableSettingsSnapshot current_snapshot(profile);
@@ -186,7 +110,6 @@ void ResetProfileSettingsHandler::OnShowResetProfileDialog(
new ResettableSettingsSnapshot(Profile::FromWebUI(web_ui())));
setting_snapshot_->RequestShortcuts(base::Bind(
&ResetProfileSettingsHandler::UpdateFeedbackUI, AsWeakPtr()));
- UpdateFeedbackUI();
Dan Beam 2015/11/06 23:52:23 why did you remove this?
dpapad 2015/11/07 00:31:08 I could not justify what it was doing. It was call
Dan Beam 2015/11/07 00:52:00 should this be removed from options/ as well, then
dpapad 2015/11/07 01:49:51 Actually after further inspection, I decided to ad
}
if (automatic_profile_resetter_)
@@ -208,12 +131,6 @@ void ResetProfileSettingsHandler::OnHideResetProfileDialog(
setting_snapshot_.reset();
}
-void ResetProfileSettingsHandler::OnDismissedResetProfileSettingsBanner(
- const base::ListValue* args) {
- if (automatic_profile_resetter_)
- automatic_profile_resetter_->NotifyDidCloseWebUIResetBanner();
-}
-
void ResetProfileSettingsHandler::OnSettingsFetched() {
DCHECK(config_fetcher_);
DCHECK(!config_fetcher_->IsActive());
@@ -257,8 +174,7 @@ void ResetProfileSettingsHandler::UpdateFeedbackUI() {
base::DictionaryValue feedback_info;
feedback_info.Set("feedbackInfo", list.release());
web_ui()->CallJavascriptFunction(
- "ResetProfileSettingsOverlay.setFeedbackInfo",
- feedback_info);
+ "SettingsResetPage.setFeedbackInfo", feedback_info);
}
-} // namespace options
+} // namespace settings
« no previous file with comments | « chrome/browser/ui/webui/settings/reset_profile_settings_handler.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698