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

Unified Diff: chrome/browser/sync/glue/session_model_associator.cc

Issue 9664008: Add Phone/Tablet device types for syncing session from Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: made function private Created 8 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/sync/glue/synced_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/session_model_associator.cc
diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc
index 86b273da31a5198f0de8811147019db2ca07f156..2ec8336220cc50ecb8b327dac836d8bb091ed2fc 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:
« no previous file with comments | « no previous file | chrome/browser/sync/glue/synced_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698