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

Side by Side Diff: components/sync_sessions/sessions_sync_manager.cc

Issue 2856913007: [Sync] Handle reassociation of tabs where the old tab is already mapped. (Closed)
Patch Set: Address comments Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/sync_sessions/sessions_sync_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync_sessions/sessions_sync_manager.h" 5 #include "components/sync_sessions/sessions_sync_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 << new_tab_id; 857 << new_tab_id;
858 858
859 // The specifics from the SyncData are immutable. Create a mutable 859 // The specifics from the SyncData are immutable. Create a mutable
860 // copy to hold the rewritten ids. 860 // copy to hold the rewritten ids.
861 sync_pb::SessionSpecifics rewritten_specifics(specifics); 861 sync_pb::SessionSpecifics rewritten_specifics(specifics);
862 rewritten_specifics.mutable_tab()->set_tab_id(new_tab_id); 862 rewritten_specifics.mutable_tab()->set_tab_id(new_tab_id);
863 session_tracker_.ReassociateLocalTab( 863 session_tracker_.ReassociateLocalTab(
864 rewritten_specifics.tab_node_id(), new_tab_id); 864 rewritten_specifics.tab_node_id(), new_tab_id);
865 UpdateTrackerWithSpecifics(rewritten_specifics, 865 UpdateTrackerWithSpecifics(rewritten_specifics,
866 remote.GetModifiedTime()); 866 remote.GetModifiedTime());
867
868 session_tracker_.ReassociateLocalTab(
869 rewritten_specifics.tab_node_id(), new_tab_id);
870 } 867 }
871 } 868 }
872 } 869 }
873 } 870 }
874 871
875 // Cleanup all foreign sessions, since orphaned tabs may have been added after 872 // Cleanup all foreign sessions, since orphaned tabs may have been added after
876 // the header. 873 // the header.
877 std::vector<const SyncedSession*> sessions; 874 std::vector<const SyncedSession*> sessions;
878 session_tracker_.LookupAllForeignSessions(&sessions, 875 session_tracker_.LookupAllForeignSessions(&sessions,
879 SyncedSessionTracker::RAW); 876 SyncedSessionTracker::RAW);
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 } 1287 }
1291 1288
1292 // static 1289 // static
1293 std::string SessionsSyncManager::TagHashFromSpecifics( 1290 std::string SessionsSyncManager::TagHashFromSpecifics(
1294 const sync_pb::SessionSpecifics& specifics) { 1291 const sync_pb::SessionSpecifics& specifics) {
1295 return syncer::GenerateSyncableHash(syncer::SESSIONS, 1292 return syncer::GenerateSyncableHash(syncer::SESSIONS,
1296 TagFromSpecifics(specifics)); 1293 TagFromSpecifics(specifics));
1297 } 1294 }
1298 1295
1299 }; // namespace sync_sessions 1296 }; // namespace sync_sessions
OLDNEW
« no previous file with comments | « no previous file | components/sync_sessions/sessions_sync_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698