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

Side by Side Diff: chrome/browser/sync/glue/session_model_associator.cc

Issue 15499005: Add a new SyncedTabDelegate for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix pre-rendering + revert changes to SessionTabHelper. Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "chrome/browser/sync/glue/session_model_associator.h" 5 #include "chrome/browser/sync/glue/session_model_associator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 sync_pb::SessionWindow_BrowserType_TYPE_POPUP); 206 sync_pb::SessionWindow_BrowserType_TYPE_POPUP);
207 } 207 }
208 208
209 // Store the order of tabs. 209 // Store the order of tabs.
210 bool found_tabs = false; 210 bool found_tabs = false;
211 for (int j = 0; j < (*i)->GetTabCount(); ++j) { 211 for (int j = 0; j < (*i)->GetTabCount(); ++j) {
212 SessionID::id_type tab_id = (*i)->GetTabIdAt(j); 212 SessionID::id_type tab_id = (*i)->GetTabIdAt(j);
213 213
214 if (reload_tabs) { 214 if (reload_tabs) {
215 SyncedTabDelegate* tab = (*i)->GetTabAt(j); 215 SyncedTabDelegate* tab = (*i)->GetTabAt(j);
216 // It's possible for GetTabAt to return a null tab if it's not in 216 // It's possible for GetTabAt to return a tab which has no web
217 // memory. We can assume this means the tab already existed but hasn't 217 // contents. We can assume this means the tab already existed but
218 // changed, so no need to reassociate. 218 // hasn't changed, so no need to reassociate.
219 if (tab && !AssociateTab(*tab, error)) { 219 if (tab->HasWebContents() && !AssociateTab(*tab, error)) {
220 // Association failed. Either we need to re-associate, or this is an 220 // Association failed. Either we need to re-associate, or this is an
221 // unrecoverable error. 221 // unrecoverable error.
222 return false; 222 return false;
223 } 223 }
224 } 224 }
225 225
226 // If the tab is valid, it would have been added to the tracker either 226 // If the tab is valid, it would have been added to the tracker either
Yaron 2013/05/30 00:47:23 Does this logic still work with the changing tab i
shashi 2013/05/30 00:56:14 Discussed offline, this should work similar to Des
227 // by the above AssociateTab call (at association time), or by the 227 // by the above AssociateTab call (at association time), or by the
228 // change processor calling AssociateTab for all modified tabs. 228 // change processor calling AssociateTab for all modified tabs.
229 // Therefore, we can key whether this window has valid tabs based on 229 // Therefore, we can key whether this window has valid tabs based on
230 // the tab's presence in the tracker. 230 // the tab's presence in the tracker.
231 const SessionTab* tab = NULL; 231 const SessionTab* tab = NULL;
232 if (synced_session_tracker_.LookupSessionTab(local_tag, tab_id, &tab)) { 232 if (synced_session_tracker_.LookupSessionTab(local_tag, tab_id, &tab)) {
233 found_tabs = true; 233 found_tabs = true;
234 window_s.add_tab(tab_id); 234 window_s.add_tab(tab_id);
235 } 235 }
236 } 236 }
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 1145
1146 bool SessionModelAssociator::CryptoReadyIfNecessary() { 1146 bool SessionModelAssociator::CryptoReadyIfNecessary() {
1147 // We only access the cryptographer while holding a transaction. 1147 // We only access the cryptographer while holding a transaction.
1148 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); 1148 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
1149 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); 1149 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes();
1150 return !encrypted_types.Has(SESSIONS) || 1150 return !encrypted_types.Has(SESSIONS) ||
1151 sync_service_->IsCryptographerReady(&trans); 1151 sync_service_->IsCryptographerReady(&trans);
1152 } 1152 }
1153 1153
1154 } // namespace browser_sync 1154 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.cc ('k') | chrome/browser/sync/glue/session_model_associator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698