diff options
Diffstat (limited to 'chrome/browser/sync')
| -rw-r--r-- | chrome/browser/sync/glue/session_model_associator.cc | 36 | ||||
| -rw-r--r-- | chrome/browser/sync/glue/synced_session.h | 4 | ||||
| -rw-r--r-- | chrome/browser/sync/protocol/proto_enum_conversions.cc | 4 |
3 files changed, 31 insertions, 13 deletions
diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc index 86b273d..2ec8336 100644 --- a/chrome/browser/sync/glue/session_model_associator.cc +++ b/chrome/browser/sync/glue/session_model_associator.cc @@ -57,6 +57,24 @@ static const int kMaxSyncNavigationCount = 6; // Default number of days without activity after which a session is considered // stale and becomes a candidate for garbage collection. static const size_t kDefaultStaleSessionThresholdDays = 14; // 2 weeks. + +sync_pb::SessionHeader::DeviceType GetLocalDeviceType() { +#if defined(OS_CHROMEOS) + return sync_pb::SessionHeader_DeviceType_TYPE_CROS; +#elif defined(OS_LINUX) + return sync_pb::SessionHeader_DeviceType_TYPE_LINUX; +#elif defined(OS_MACOSX) + return sync_pb::SessionHeader_DeviceType_TYPE_MAC; +#elif defined(OS_WIN) + return sync_pb::SessionHeader_DeviceType_TYPE_WIN; +#elif defined(OS_ANDROID) + // TODO(yfriedman): Add logic to conditionally set device_type to tablet. + return sync_pb::SessionHeader_DeviceType_TYPE_PHONE; +#else + return sync_pb::SessionHeader_DeviceType_TYPE_OTHER; +#endif +} + } // namespace SessionModelAssociator::SessionModelAssociator(ProfileSyncService* sync_service) @@ -153,17 +171,7 @@ bool SessionModelAssociator::AssociateWindows(bool reload_tabs, synced_session_tracker_.GetSession(local_tag); current_session->modified_time = base::Time::Now(); header_s->set_client_name(current_session_name_); -#if defined(OS_CHROMEOS) - header_s->set_device_type(sync_pb::SessionHeader_DeviceType_TYPE_CROS); -#elif defined(OS_LINUX) - header_s->set_device_type(sync_pb::SessionHeader_DeviceType_TYPE_LINUX); -#elif defined(OS_MACOSX) - header_s->set_device_type(sync_pb::SessionHeader_DeviceType_TYPE_MAC); -#elif defined(OS_WIN) - header_s->set_device_type(sync_pb::SessionHeader_DeviceType_TYPE_WIN); -#else - header_s->set_device_type(sync_pb::SessionHeader_DeviceType_TYPE_OTHER); -#endif + header_s->set_device_type(GetLocalDeviceType()); synced_session_tracker_.ResetSessionTracking(local_tag); std::set<SyncedWindowDelegate*> windows = @@ -721,6 +729,12 @@ void SessionModelAssociator::PopulateSessionHeaderFromSpecifics( case sync_pb::SessionHeader_DeviceType_TYPE_CROS: session_header->device_type = SyncedSession::TYPE_CHROMEOS; break; + case sync_pb::SessionHeader_DeviceType_TYPE_PHONE: + session_header->device_type = SyncedSession::TYPE_PHONE; + break; + case sync_pb::SessionHeader_DeviceType_TYPE_TABLET: + session_header->device_type = SyncedSession::TYPE_TABLET; + break; case sync_pb::SessionHeader_DeviceType_TYPE_OTHER: // Intentionally fall-through default: diff --git a/chrome/browser/sync/glue/synced_session.h b/chrome/browser/sync/glue/synced_session.h index c4037dd..c87cc28 100644 --- a/chrome/browser/sync/glue/synced_session.h +++ b/chrome/browser/sync/glue/synced_session.h @@ -30,7 +30,9 @@ struct SyncedSession { TYPE_MACOSX = 2, TYPE_LINUX = 3, TYPE_CHROMEOS = 4, - TYPE_OTHER = 5 + TYPE_OTHER = 5, + TYPE_PHONE = 6, + TYPE_TABLET = 7 }; SyncedSession(); diff --git a/chrome/browser/sync/protocol/proto_enum_conversions.cc b/chrome/browser/sync/protocol/proto_enum_conversions.cc index 4832b85..030e53f 100644 --- a/chrome/browser/sync/protocol/proto_enum_conversions.cc +++ b/chrome/browser/sync/protocol/proto_enum_conversions.cc @@ -92,13 +92,15 @@ const char* GetUpdatesSourceString( const char* GetDeviceTypeString( sync_pb::SessionHeader::DeviceType device_type) { - ASSERT_ENUM_BOUNDS(sync_pb::SessionHeader, DeviceType, TYPE_WIN, TYPE_OTHER); + ASSERT_ENUM_BOUNDS(sync_pb::SessionHeader, DeviceType, TYPE_WIN, TYPE_TABLET); switch (device_type) { ENUM_CASE(sync_pb::SessionHeader, TYPE_WIN); ENUM_CASE(sync_pb::SessionHeader, TYPE_MAC); ENUM_CASE(sync_pb::SessionHeader, TYPE_LINUX); ENUM_CASE(sync_pb::SessionHeader, TYPE_CROS); ENUM_CASE(sync_pb::SessionHeader, TYPE_OTHER); + ENUM_CASE(sync_pb::SessionHeader, TYPE_PHONE); + ENUM_CASE(sync_pb::SessionHeader, TYPE_TABLET); } NOTREACHED(); return ""; |
