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

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

Issue 10827093: [Sync] Preserve old SessionSpecifics data when overwriting tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | no next file » | 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 0cf69e62882042673c1f0884ef48e163aa0ea392..67a017daa6ae2243dfe473bf70e2fe5c4eeecbe7 100644
--- a/chrome/browser/sync/glue/session_model_associator.cc
+++ b/chrome/browser/sync/glue/session_model_associator.cc
@@ -387,13 +387,11 @@ bool SessionModelAssociator::WriteTabContentsToSyncModel(
synced_session_tracker_.GetTab(GetCurrentMachineTag(),
tab.GetSessionId());
- // We build a clean session specifics directly from the tab data.
- sync_pb::SessionSpecifics session_s;
- session_s.set_session_tag(GetCurrentMachineTag());
- sync_pb::SessionTab* tab_s = session_s.mutable_tab();
+ // We build a clean session tab specifics directly from the tab data.
+ sync_pb::SessionTab tab_s;
rlarocque 2012/07/31 21:15:56 That's an unusual variable name, though I guess it
GURL new_url;
- AssociateTabContents(window, tab, session_tab, tab_s, &new_url);
+ AssociateTabContents(window, tab, session_tab, &tab_s, &new_url);
// Trigger the favicon load if needed. We do this before opening the write
// transaction to avoid jank.
@@ -418,23 +416,22 @@ bool SessionModelAssociator::WriteTabContentsToSyncModel(
return false;
}
+ sync_pb::SessionSpecifics specifics = tab_node.GetSessionSpecifics();
if (new_url == old_tab_url) {
// Load the old specifics and copy over the favicon data if needed.
// TODO(zea): store local favicons in the |synced_favicons_| map and use
// that instead of reading from sync. This will be necessary to switch to
// the new api.
- const sync_pb::SessionSpecifics old_specifics =
- tab_node.GetSessionSpecifics();
- tab_s->set_favicon(old_specifics.tab().favicon());
- tab_s->set_favicon_source(old_specifics.tab().favicon_source());
- tab_s->set_favicon_type(old_specifics.tab().favicon_type());
+ tab_s.set_favicon(specifics.tab().favicon());
+ tab_s.set_favicon_source(specifics.tab().favicon_source());
+ tab_s.set_favicon_type(specifics.tab().favicon_type());
}
-
- // Note: we don't need to preserve unknown fields since we're the only ones
- // who can write to this node (other clients can only delete).
+ // Retain the base SessionSpecifics data (tag, tab_node_id, etc.), and just
+ // write the new SessionTabSpecifics.
+ specifics.mutable_tab()->CopyFrom(tab_s);
// Write into the actual sync model.
- tab_node.SetSessionSpecifics(session_s);
+ tab_node.SetSessionSpecifics(specifics);
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698