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

Unified Diff: chrome/browser/search_engines/template_url_service.cc

Issue 263823007: Handle TemplateURLService load failure better (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/search_engines/template_url_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/template_url_service.cc
diff --git a/chrome/browser/search_engines/template_url_service.cc b/chrome/browser/search_engines/template_url_service.cc
index 817756c296f27528bf9760a94e42b36057b6b35d..4cbc15c4f2291790837459591c5efde53a02fec6 100644
--- a/chrome/browser/search_engines/template_url_service.cc
+++ b/chrome/browser/search_engines/template_url_service.cc
@@ -976,12 +976,10 @@ void TemplateURLService::Load() {
service_ = WebDataService::FromBrowserContext(profile_);
}
- if (service_.get()) {
+ if (service_)
load_handle_ = service_->GetKeywords(this);
- } else {
- ChangeToLoadedState();
- on_loaded_callbacks_.Notify();
- }
+ else
+ OnFailedLoad();
}
scoped_ptr<TemplateURLService::Subscription>
@@ -1003,8 +1001,7 @@ void TemplateURLService::OnWebDataServiceRequestDone(
// Results are null if the database went away or (most likely) wasn't
// loaded.
load_failed_ = true;
erikwright (departed) 2014/05/03 01:01:54 Shouldn't this also be set in the '!service_' case
Peter Kasting 2014/05/05 18:46:24 Yes. Moved to OnFailedLoad().
- ChangeToLoadedState();
- on_loaded_callbacks_.Notify();
+ OnFailedLoad();
return;
}
@@ -1785,6 +1782,15 @@ void TemplateURLService::ChangeToLoadedState() {
loaded_ = true;
}
+void TemplateURLService::OnFailedLoad() {
+ TemplateURL* default_search_provider =
+ initial_default_search_provider_.release();
+ AddNoNotify(default_search_provider, true);
+ SetDefaultSearchProviderNoNotify(default_search_provider);
+ ChangeToLoadedState();
+ on_loaded_callbacks_.Notify();
+}
+
void TemplateURLService::ClearDefaultProviderFromPrefs() {
// We overwrite user preferences. If the default search engine is managed,
// there is no effect.
« no previous file with comments | « chrome/browser/search_engines/template_url_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698