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

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

Issue 62193002: Integrate UI and reset logic into AutomaticProfileResetter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reduced boilerplate in unit tests. Created 7 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
Index: chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
diff --git a/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc b/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
index bcbada861b6dca6b882b72333bb0f41b989a32d8..aa45c5b934c3b4f2f8b469076087e58b092d840b 100644
--- a/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/reset_profile_settings_handler.cc
@@ -11,6 +11,8 @@
#include "base/strings/string16.h"
#include "base/values.h"
#include "chrome/browser/google/google_util.h"
+#include "chrome/browser/profile_resetter/automatic_profile_resetter.h"
+#include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h"
#include "chrome/browser/profile_resetter/brandcode_config_fetcher.h"
#include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
#include "chrome/browser/profile_resetter/profile_resetter.h"
@@ -30,11 +32,17 @@ ResetProfileSettingsHandler::ResetProfileSettingsHandler() {
}
ResetProfileSettingsHandler::~ResetProfileSettingsHandler() {
+ // Will be ignored if it was already called in OnResetProfileSettingsDone.
+ automatic_profile_resetter_->NotifyDidCloseWebUIResetDialog(
+ false /*performed_reset*/);
}
void ResetProfileSettingsHandler::InitializeHandler() {
Profile* profile = Profile::FromWebUI(web_ui());
resetter_.reset(new ProfileResetter(profile));
+ automatic_profile_resetter_ =
+ AutomaticProfileResetterFactory::GetForBrowserContext(profile);
+ DCHECK(automatic_profile_resetter_);
}
void ResetProfileSettingsHandler::InitializePage() {
@@ -100,10 +108,15 @@ void ResetProfileSettingsHandler::OnResetProfileSettingsDone() {
setting_snapshot_->Subtract(current_snapshot);
std::string report = SerializeSettingsReport(*setting_snapshot_,
difference);
- SendSettingsFeedback(report, profile, PROFILE_RESET_WEBUI);
+ bool is_reset_prompt_active =
+ automatic_profile_resetter_->IsResetPromptActive();
+ SendSettingsFeedback(report, profile, is_reset_prompt_active ?
+ PROFILE_RESET_PROMPT : PROFILE_RESET_WEBUI);
}
setting_snapshot_.reset();
}
+ automatic_profile_resetter_->NotifyDidCloseWebUIResetDialog(
+ true /*performed_reset*/);
}
void ResetProfileSettingsHandler::OnShowResetProfileDialog(const ListValue*) {
@@ -114,6 +127,8 @@ void ResetProfileSettingsHandler::OnShowResetProfileDialog(const ListValue*) {
"ResetProfileSettingsOverlay.setFeedbackInfo",
flashInfo);
+ automatic_profile_resetter_->NotifyDidOpenWebUIResetDialog();
+
if (brandcode_.empty())
return;
config_fetcher_.reset(new BrandcodeConfigFetcher(

Powered by Google App Engine
This is Rietveld 408576698