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

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

Issue 217613002: Misc. cleanup found while mucking with search engines code: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 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 | « no previous file | chrome/browser/webdata/keyword_table.h » ('j') | chrome/browser/webdata/keyword_table.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/template_url_service.cc
===================================================================
--- chrome/browser/search_engines/template_url_service.cc (revision 259649)
+++ chrome/browser/search_engines/template_url_service.cc (working copy)
@@ -888,13 +888,12 @@
// TODO(pkasting): Rather than communicating via prefs, we should eventually
// observe policy changes directly.
UpdateDefaultSearch();
- } else if (type == chrome::NOTIFICATION_GOOGLE_URL_UPDATED) {
+ } else {
+ DCHECK_EQ(chrome::NOTIFICATION_GOOGLE_URL_UPDATED, type);
if (loaded_) {
GoogleBaseURLChanged(
content::Details<GoogleURLTracker::UpdatedDetails>(details)->first);
}
- } else {
- NOTREACHED();
}
}
@@ -992,11 +991,9 @@
FindNonExtensionTemplateURLForKeyword(turl->keyword());
if (iter->change_type() == syncer::SyncChange::ACTION_DELETE) {
if (!existing_turl) {
- NOTREACHED() << "Unexpected sync change state.";
error = sync_error_factory_->CreateAndUploadError(
FROM_HERE,
"ProcessSyncChanges failed on ChangeType ACTION_DELETE");
- LOG(ERROR) << "Trying to delete a non-existent TemplateURL.";
continue;
}
if (existing_turl == GetDefaultSearchProvider()) {
@@ -1034,11 +1031,9 @@
Remove(existing_turl);
} else if (iter->change_type() == syncer::SyncChange::ACTION_ADD) {
if (existing_turl) {
- NOTREACHED() << "Unexpected sync change state.";
error = sync_error_factory_->CreateAndUploadError(
FROM_HERE,
"ProcessSyncChanges failed on ChangeType ACTION_ADD");
- LOG(ERROR) << "Trying to add an existing TemplateURL.";
continue;
}
const std::string guid = turl->sync_guid();
@@ -1056,11 +1051,9 @@
SetDefaultSearchProviderIfNewlySynced(guid);
} else if (iter->change_type() == syncer::SyncChange::ACTION_UPDATE) {
if (!existing_turl) {
- NOTREACHED() << "Unexpected sync change state.";
error = sync_error_factory_->CreateAndUploadError(
FROM_HERE,
"ProcessSyncChanges failed on ChangeType ACTION_UPDATE");
- LOG(ERROR) << "Trying to update a non-existent TemplateURL.";
continue;
}
if (existing_keyword_turl && (existing_keyword_turl != existing_turl)) {
@@ -1074,7 +1067,6 @@
NotifyObservers();
} else {
// We've unexpectedly received an ACTION_INVALID.
- NOTREACHED() << "Unexpected sync change state.";
error = sync_error_factory_->CreateAndUploadError(
FROM_HERE,
"ProcessSyncChanges received an ACTION_INVALID");
@@ -1453,8 +1445,8 @@
&TemplateURLService::OnSyncedDefaultSearchProviderGUIDChanged,
base::Unretained(this)));
}
- notification_registrar_.Add(this,
- chrome::NOTIFICATION_DEFAULT_SEARCH_POLICY_CHANGED,
+ notification_registrar_.Add(
+ this, chrome::NOTIFICATION_DEFAULT_SEARCH_POLICY_CHANGED,
content::NotificationService::AllSources());
if (num_initializers > 0) {
@@ -2187,7 +2179,7 @@
}
if (service_.get())
- service_->SetDefaultSearchProvider(url);
+ service_->SetDefaultSearchProviderID(url ? url->id() : 0);
// Inform sync the change to the show_in_default_list flag.
if (url)
@@ -2252,17 +2244,13 @@
}
void TemplateURLService::RemoveNoNotify(TemplateURL* template_url) {
+ DCHECK(template_url != default_search_provider_);
+
TemplateURLVector::iterator i =
std::find(template_urls_.begin(), template_urls_.end(), template_url);
if (i == template_urls_.end())
return;
- if (template_url == default_search_provider_) {
- // Should never delete the default search provider.
- NOTREACHED();
- return;
- }
-
RemoveFromMaps(template_url);
// Remove it from the vector containing all TemplateURLs.
« no previous file with comments | « no previous file | chrome/browser/webdata/keyword_table.h » ('j') | chrome/browser/webdata/keyword_table.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698