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

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: add a ResetWebContents to SyncedTabDelegateAndroid. Created 7 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 | 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 sync_pb::SessionWindow_BrowserType_TYPE_POPUP); 230 sync_pb::SessionWindow_BrowserType_TYPE_POPUP);
231 } 231 }
232 232
233 // Store the order of tabs. 233 // Store the order of tabs.
234 bool found_tabs = false; 234 bool found_tabs = false;
235 for (int j = 0; j < (*i)->GetTabCount(); ++j) { 235 for (int j = 0; j < (*i)->GetTabCount(); ++j) {
236 SessionID::id_type tab_id = (*i)->GetTabIdAt(j); 236 SessionID::id_type tab_id = (*i)->GetTabIdAt(j);
237 237
238 if (reload_tabs) { 238 if (reload_tabs) {
239 SyncedTabDelegate* tab = (*i)->GetTabAt(j); 239 SyncedTabDelegate* tab = (*i)->GetTabAt(j);
240 // It's possible for GetTabAt to return a null tab if it's not in 240 // It's possible for GetTabAt to return a tab which has no web
241 // memory. We can assume this means the tab already existed but hasn't 241 // contents. We can assume this means the tab already existed but
242 // changed, so no need to reassociate. 242 // hasn't changed, so no need to reassociate.
243 if (tab && !AssociateTab(*tab, error)) { 243 if (tab->HasWebContents() && !AssociateTab(*tab, error)) {
244 // Association failed. Either we need to re-associate, or this is an 244 // Association failed. Either we need to re-associate, or this is an
245 // unrecoverable error. 245 // unrecoverable error.
246 return false; 246 return false;
247 } 247 }
248 } 248 }
249 249
250 // If the tab is valid, it would have been added to the tracker either 250 // If the tab is valid, it would have been added to the tracker either
251 // by the above AssociateTab call (at association time), or by the 251 // by the above AssociateTab call (at association time), or by the
252 // change processor calling AssociateTab for all modified tabs. 252 // change processor calling AssociateTab for all modified tabs.
253 // Therefore, we can key whether this window has valid tabs based on 253 // Therefore, we can key whether this window has valid tabs based on
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 1161
1162 bool SessionModelAssociator::CryptoReadyIfNecessary() { 1162 bool SessionModelAssociator::CryptoReadyIfNecessary() {
1163 // We only access the cryptographer while holding a transaction. 1163 // We only access the cryptographer while holding a transaction.
1164 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); 1164 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
1165 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); 1165 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes();
1166 return !encrypted_types.Has(SESSIONS) || 1166 return !encrypted_types.Has(SESSIONS) ||
1167 sync_service_->IsCryptographerReady(&trans); 1167 sync_service_->IsCryptographerReady(&trans);
1168 } 1168 }
1169 1169
1170 } // namespace browser_sync 1170 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698