diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 01:29:01 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 01:29:01 +0000 |
commit | 315cc09d944e53adab3d62c708bcaba9df446355 (patch) | |
tree | b1e3ddda9edff19377501239d027a425402c1c6c /chrome | |
parent | 21129ec446e74966d3b1edbcdb37bbaf31c5fc40 (diff) | |
download | chromium_src-315cc09d944e53adab3d62c708bcaba9df446355.zip chromium_src-315cc09d944e53adab3d62c708bcaba9df446355.tar.gz chromium_src-315cc09d944e53adab3d62c708bcaba9df446355.tar.bz2 |
Made server_notifier_thread listen to UNKNOWN data type.
This is a temporary workaround so that server-issued notifications work
for new sync data types.
BUG=none
TEST=manual
Review URL: http://codereview.chromium.org/3114012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56290 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
4 files changed, 29 insertions, 3 deletions
diff --git a/chrome/browser/sync/notifier/chrome_invalidation_client.cc b/chrome/browser/sync/notifier/chrome_invalidation_client.cc index f183e61..6701261 100644 --- a/chrome/browser/sync/notifier/chrome_invalidation_client.cc +++ b/chrome/browser/sync/notifier/chrome_invalidation_client.cc @@ -76,6 +76,10 @@ void ChromeInvalidationClient::RegisterTypes() { i < syncable::MODEL_TYPE_COUNT; ++i) { registration_manager_->RegisterType(syncable::ModelTypeFromInt(i)); } + // TODO(akalin): This is a hack to make new sync data types work + // with server-issued notifications. Remove this when it's not + // needed anymore. + registration_manager_->RegisterType(syncable::UNSPECIFIED); } void ChromeInvalidationClient::Invalidate( diff --git a/chrome/browser/sync/notifier/registration_manager.cc b/chrome/browser/sync/notifier/registration_manager.cc index 3895c91..ccadac4 100644 --- a/chrome/browser/sync/notifier/registration_manager.cc +++ b/chrome/browser/sync/notifier/registration_manager.cc @@ -60,8 +60,7 @@ void RegistrationManager::MarkRegistrationLost( RegistrationStatusMap::iterator it = registration_status_.find(model_type); if (it == registration_status_.end()) { - LOG(ERROR) << "Unknown model type: " - << syncable::ModelTypeToString(model_type); + LOG(ERROR) << "Unknown model type: " << model_type; return; } it->second = UNREGISTERED; diff --git a/chrome/browser/sync/notifier/server_notifier_thread.cc b/chrome/browser/sync/notifier/server_notifier_thread.cc index 19417f9..8b2aba3 100644 --- a/chrome/browser/sync/notifier/server_notifier_thread.cc +++ b/chrome/browser/sync/notifier/server_notifier_thread.cc @@ -55,7 +55,14 @@ void ServerNotifierThread::SendNotification( void ServerNotifierThread::OnInvalidate(syncable::ModelType model_type) { DCHECK_EQ(MessageLoop::current(), worker_message_loop()); - LOG(INFO) << "OnInvalidate: " << syncable::ModelTypeToString(model_type); + // TODO(akalin): This is a hack to make new sync data types work + // with server-issued notifications. Remove this when it's not + // needed anymore. + if (model_type == syncable::UNSPECIFIED) { + LOG(INFO) << "OnInvalidate: UNKNOWN"; + } else { + LOG(INFO) << "OnInvalidate: " << syncable::ModelTypeToString(model_type); + } // TODO(akalin): Signal notification only for the invalidated types. parent_message_loop_->PostTask( FROM_HERE, diff --git a/chrome/browser/sync/syncable/model_type.cc b/chrome/browser/sync/syncable/model_type.cc index a7b07c2..bb1de93 100644 --- a/chrome/browser/sync/syncable/model_type.cc +++ b/chrome/browser/sync/syncable/model_type.cc @@ -153,6 +153,10 @@ const char kTypedUrlNotificationType[] = "TYPED_URL"; const char kExtensionNotificationType[] = "EXTENSION"; const char kNigoriNotificationType[] = "NIGORI"; const char kAppNotificationType[] = "APP"; +// TODO(akalin): This is a hack to make new sync data types work with +// server-issued notifications. Remove this when it's not needed +// anymore. +const char kUnknownNotificationType[] = "UNKNOWN"; } // namespace bool RealModelTypeToNotificationType(ModelType model_type, @@ -185,6 +189,12 @@ bool RealModelTypeToNotificationType(ModelType model_type, case APPS: *notification_type = kAppNotificationType; return true; + // TODO(akalin): This is a hack to make new sync data types work with + // server-issued notifications. Remove this when it's not needed + // anymore. + case UNSPECIFIED: + *notification_type = kUnknownNotificationType; + return true; default: break; } @@ -221,6 +231,12 @@ bool NotificationTypeToRealModelType(const std::string& notification_type, } else if (notification_type == kAppNotificationType) { *model_type = APPS; return true; + } else if (notification_type == kUnknownNotificationType) { + // TODO(akalin): This is a hack to make new sync data types work with + // server-issued notifications. Remove this when it's not needed + // anymore. + *model_type = UNSPECIFIED; + return true; } *model_type = UNSPECIFIED; return false; |