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

Side by Side Diff: ios/chrome/browser/ui/ntp/recent_tabs/synced_sessions.mm

Issue 2499023004: [Sync] Introduce SyncedSessionWindow type. (Closed)
Patch Set: Address comments Created 3 years, 8 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 | « components/sync_sessions/synced_session_tracker_unittest.cc ('k') | no next file » | 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 "ios/chrome/browser/ui/ntp/recent_tabs/synced_sessions.h" 5 #include "ios/chrome/browser/ui/ntp/recent_tabs/synced_sessions.h"
6 6
7 #include <functional> 7 #include <functional>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Order tabs by recency. 99 // Order tabs by recency.
100 std::vector<const sessions::SessionTab*> session_tabs; 100 std::vector<const sessions::SessionTab*> session_tabs;
101 open_tabs->GetForeignSessionTabs(synced_session->session_tag, 101 open_tabs->GetForeignSessionTabs(synced_session->session_tag,
102 &session_tabs); 102 &session_tabs);
103 for (const auto* session_tab : session_tabs) { 103 for (const auto* session_tab : session_tabs) {
104 AddTabToDistantSession(*session_tab, synced_session->session_tag, this); 104 AddTabToDistantSession(*session_tab, synced_session->session_tag, this);
105 } 105 }
106 } else { 106 } else {
107 // Order tabs by their visual position within window. 107 // Order tabs by their visual position within window.
108 for (const auto& kv : synced_session->windows) { 108 for (const auto& kv : synced_session->windows) {
109 for (const auto& session_tab : kv.second->tabs) { 109 for (const auto& session_tab : kv.second->wrapped_window.tabs) {
110 AddTabToDistantSession(*session_tab, synced_session->session_tag, this); 110 AddTabToDistantSession(*session_tab, synced_session->session_tag, this);
111 } 111 }
112 } 112 }
113 } 113 }
114 } 114 }
115 115
116 SyncedSessions::SyncedSessions() {} 116 SyncedSessions::SyncedSessions() {}
117 117
118 SyncedSessions::SyncedSessions(syncer::SyncService* sync_service) { 118 SyncedSessions::SyncedSessions(syncer::SyncService* sync_service) {
119 DCHECK(sync_service); 119 DCHECK(sync_service);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 DCHECK_LE(index, GetSessionCount()); 167 DCHECK_LE(index, GetSessionCount());
168 sessions_.erase(sessions_.begin() + index); 168 sessions_.erase(sessions_.begin() + index);
169 } 169 }
170 170
171 void SyncedSessions::AddDistantSessionForTest( 171 void SyncedSessions::AddDistantSessionForTest(
172 std::unique_ptr<const DistantSession> distant_session) { 172 std::unique_ptr<const DistantSession> distant_session) {
173 sessions_.push_back(std::move(distant_session)); 173 sessions_.push_back(std::move(distant_session));
174 } 174 }
175 175
176 } // synced_sessions namespace 176 } // synced_sessions namespace
OLDNEW
« no previous file with comments | « components/sync_sessions/synced_session_tracker_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698