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

Unified Diff: components/sync_sessions/synced_session.cc

Issue 2499023004: [Sync] Introduce SyncedSessionWindow type. (Closed)
Patch Set: Address comments Created 3 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 | « components/sync_sessions/synced_session.h ('k') | components/sync_sessions/synced_session_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync_sessions/synced_session.cc
diff --git a/components/sync_sessions/synced_session.cc b/components/sync_sessions/synced_session.cc
index c22e1728d20354764f5a530b179f27f962af8194..0cba248c8f648afcc33551ca3dcb0a79dc9e659b 100644
--- a/components/sync_sessions/synced_session.cc
+++ b/components/sync_sessions/synced_session.cc
@@ -6,16 +6,32 @@
namespace sync_sessions {
+SyncedSessionWindow::SyncedSessionWindow() {}
+
+SyncedSessionWindow::~SyncedSessionWindow() {}
+
+sync_pb::SessionWindow SyncedSessionWindow::ToSessionWindowProto() const {
+ sync_pb::SessionWindow sync_data;
+ sync_data.set_browser_type(window_type);
+ sync_data.set_window_id(wrapped_window.window_id.id());
+ sync_data.set_selected_tab_index(wrapped_window.selected_tab_index);
+
+ for (const auto& tab : wrapped_window.tabs)
+ sync_data.add_tab(tab->tab_id.id());
+
+ return sync_data;
+}
+
SyncedSession::SyncedSession()
: session_tag("invalid"), device_type(TYPE_UNSET) {}
SyncedSession::~SyncedSession() {}
-sync_pb::SessionHeader SyncedSession::ToSessionHeader() const {
+sync_pb::SessionHeader SyncedSession::ToSessionHeaderProto() const {
sync_pb::SessionHeader header;
for (const auto& window_pair : windows) {
sync_pb::SessionWindow* w = header.add_window();
- w->CopyFrom(window_pair.second->ToSyncData());
+ w->CopyFrom(window_pair.second->ToSessionWindowProto());
}
header.set_client_name(session_name);
switch (device_type) {
« no previous file with comments | « components/sync_sessions/synced_session.h ('k') | components/sync_sessions/synced_session_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698