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

Unified Diff: chrome/browser/profile_resetter/profile_resetter.cc

Issue 15572002: Implemented 'Reset Search engines' feature. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Android compilation error Created 7 years, 7 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
Index: chrome/browser/profile_resetter/profile_resetter.cc
diff --git a/chrome/browser/profile_resetter/profile_resetter.cc b/chrome/browser/profile_resetter/profile_resetter.cc
index 2528754e54cd862b11263556b1dcaddd7be86fc1..72b25465201118497322c4b932b310d5222f6c2d 100644
--- a/chrome/browser/profile_resetter/profile_resetter.cc
+++ b/chrome/browser/profile_resetter/profile_resetter.cc
@@ -5,12 +5,16 @@
#include "chrome/browser/profile_resetter/profile_resetter.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
+#include "chrome/browser/search_engines/template_url_service.h"
+#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "content/public/browser/browser_thread.h"
ProfileResetter::ProfileResetter(Profile* profile)
: profile_(profile),
pending_reset_flags_(0) {
DCHECK(CalledOnValidThread());
+ DCHECK(profile_);
}
ProfileResetter::~ProfileResetter() {}
@@ -75,8 +79,14 @@ void ProfileResetter::MarkAsDone(Resettable resettable) {
void ProfileResetter::ResetDefaultSearchEngine() {
DCHECK(CalledOnValidThread());
- NOTIMPLEMENTED();
- // TODO(battre/vabr): Implement
+
+ TemplateURLPrepopulateData::ClearPrepopulatedEnginesInPrefs(profile_);
+ TemplateURLService* template_url_service =
+ TemplateURLServiceFactory::GetForProfile(profile_);
+ DCHECK(template_url_service);
+ template_url_service->ClearDefaultProviderFromPrefs();
+ template_url_service->ResetNonExtensionURLs();
+
MarkAsDone(DEFAULT_SEARCH_ENGINE);
}

Powered by Google App Engine
This is Rietveld 408576698