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

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

Issue 2371303002: md-settings: add routing to chrome://settings/triggeredResetProfileSettings (Closed)
Patch Set: Rebase Created 4 years, 2 months 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_settings_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/reset_settings_handler.cc
diff --git a/chrome/browser/ui/webui/settings/reset_settings_handler.cc b/chrome/browser/ui/webui/settings/reset_settings_handler.cc
index 6ede5f095966b26b03d47d4616409a4ddca3a45a..5b22720cc10c9466ebabb65ef03eef35872ff366 100644
--- a/chrome/browser/ui/webui/settings/reset_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/reset_settings_handler.cc
@@ -22,10 +22,12 @@
#include "chrome/browser/profile_resetter/resettable_settings_snapshot.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
+#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "ui/base/l10n/l10n_util.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/browser_process.h"
@@ -90,6 +92,10 @@ void ResetSettingsHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("onHideResetProfileBanner",
base::Bind(&ResetSettingsHandler::OnHideResetProfileBanner,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "getTriggeredResetToolName",
+ base::Bind(&ResetSettingsHandler::HandleGetTriggeredResetToolName,
+ base::Unretained(this)));
#if defined(OS_CHROMEOS)
web_ui()->RegisterMessageCallback(
"onPowerwashDialogShow",
@@ -233,6 +239,39 @@ ProfileResetter* ResetSettingsHandler::GetResetter() {
return resetter_.get();
}
+void ResetSettingsHandler::HandleGetTriggeredResetToolName(
+ const base::ListValue* args) {
+ AllowJavascript();
+
+ CHECK_EQ(1U, args->GetSize());
+ const base::Value* callback_id;
+ CHECK(args->Get(0, &callback_id));
+
+ // Set up the localized strings for the triggered profile reset dialog.
+ // Custom reset tool names are supported on Windows only.
+ 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();
+
+ // Now that a reset UI has been shown, don't trigger again for this profile.
+ triggered_profile_resetter->ClearResetTrigger();
+ }
+#endif // defined(OS_WIN)
+
+ if (reset_tool_name.empty()) {
+ reset_tool_name = l10n_util::GetStringUTF16(
+ IDS_TRIGGERED_RESET_PROFILE_SETTINGS_DEFAULT_TOOL_NAME);
+ }
+
+ base::StringValue string_value(reset_tool_name);
+ ResolveJavascriptCallback(*callback_id, string_value);
+}
+
#if defined(OS_CHROMEOS)
void ResetSettingsHandler::OnShowPowerwashDialog(
const base::ListValue* args) {
« no previous file with comments | « chrome/browser/ui/webui/settings/reset_settings_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698