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

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

Issue 272573004: Handle TemplateURLService load failure better, and make some test correctness fixes that will be ne… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase after revert / presubmit fixes. Created 6 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/search_engines/template_url_service.h
diff --git a/chrome/browser/search_engines/template_url_service.h b/chrome/browser/search_engines/template_url_service.h
index 172932304bac18700e878f52f7271b96987fd0cd..a39e73f30ae0a6de4da55ec660ec38e9c075e3f3 100644
--- a/chrome/browser/search_engines/template_url_service.h
+++ b/chrome/browser/search_engines/template_url_service.h
@@ -112,11 +112,6 @@ class TemplateURLService : public WebDataServiceConsumer,
scoped_ptr<TemplateURLData>* default_provider_data,
bool* is_managed);
- // Saves enough of url to |prefs| so that it can be loaded from preferences on
- // start up.
- static void SaveDefaultSearchProviderToPrefs(const TemplateURL* url,
- PrefService* prefs);
-
// Generates a suitable keyword for the specified url, which must be valid.
// This is guaranteed not to return an empty string, since TemplateURLs should
// never have an empty keyword.
@@ -140,6 +135,11 @@ class TemplateURLService : public WebDataServiceConsumer,
const TemplateURL* t_url,
const SearchTermsData& search_terms_data);
+ // Saves enough of url to |prefs| so that it can be loaded from preferences on
+ // start up.
+ void SaveDefaultSearchProviderToPrefs(const TemplateURL* url,
+ PrefService* prefs) const;
+
// Returns true if there is no TemplateURL that conflicts with the
// keyword/url pair, or there is one but it can be replaced. If there is an
// existing keyword that can be replaced and template_url_to_replace is
@@ -409,16 +409,12 @@ class TemplateURLService : public WebDataServiceConsumer,
DontUpdateKeywordSearchForNonReplaceable);
FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceTest, ChangeGoogleBaseValue);
FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceTest, MergeDeletesUnusedProviders);
- FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest,
- CreateSyncDataFromTemplateURL);
- FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest,
- CreateTemplateURLFromSyncData);
FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest, UniquifyKeyword);
FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest,
+ IsLocalTemplateURLBetter);
+ FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest,
ResolveSyncKeywordConflict);
FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest, PreSyncDeletes);
- FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest,
- IsLocalTemplateURLBetter);
FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest, MergeInSyncTemplateURL);
friend class TemplateURLServiceTestUtilBase;
@@ -568,6 +564,13 @@ class TemplateURLService : public WebDataServiceConsumer,
// Caller is responsible for notifying observers.
void RemoveNoNotify(TemplateURL* template_url);
+ // Like ResetTemplateURL(), but instead of notifying observers, returns
+ // whether anything has changed.
+ bool ResetTemplateURLNoNotify(TemplateURL* url,
+ const base::string16& title,
+ const base::string16& keyword,
+ const std::string& search_url);
+
// Notify the observers that the model has changed. This is done only if the
// model is loaded.
void NotifyObservers();
@@ -713,7 +716,9 @@ class TemplateURLService : public WebDataServiceConsumer,
// Whether the keywords have been loaded.
bool loaded_;
- // Did loading fail? This is only valid if loaded_ is true.
+ // Set when the web data service fails to load properly. This prevents
+ // further communication with sync or writing to prefs, so we don't persist
+ // inconsistent state data anywhere.
bool load_failed_;
// If non-zero, we're waiting on a load.
« no previous file with comments | « chrome/browser/search_engines/template_url.cc ('k') | chrome/browser/search_engines/template_url_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698