summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/glue
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/sync/glue')
-rw-r--r--chrome/browser/sync/glue/session_model_associator.cc36
-rw-r--r--chrome/browser/sync/glue/synced_session.h4
2 files changed, 28 insertions, 12 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();