-bool SessionsSyncManager::ShouldSyncTab(const SyncedTabDelegate& tab) const {
- if (tab.profile() != profile_)
- return false;
-
- if (SyncedWindowDelegate::FindSyncedWindowDelegateWithId(
- tab.GetWindowId()) == NULL) {
- return false;
- }
-
- // Does the tab have a valid NavigationEntry?
- if (tab.ProfileIsManaged() && tab.GetBlockedNavigations()->size() > 0)
- return true;
-
- int entry_count = tab.GetEntryCount();
- if (entry_count == 0)
- return false; // This deliberately ignores a new pending entry.
-
- int pending_index = tab.GetPendingEntryIndex();
- bool found_valid_url = false;
- for (int i = 0; i < entry_count; ++i) {
- const content::NavigationEntry* entry = (i == pending_index) ?
- tab.GetPendingEntry() : tab.GetEntryAtIndex(i);
- if (!entry)
- return false;
- const GURL& virtual_url = entry->GetVirtualURL();
- if (virtual_url.is_valid() &&
- !virtual_url.SchemeIs(chrome::kChromeUIScheme) &&
- !virtual_url.SchemeIs(chrome::kChromeNativeScheme) &&
- !virtual_url.SchemeIsFile()) {
- found_valid_url = true;
- }
- }
- return found_valid_url;
-}
-
-// static.
-bool SessionsSyncManager::ShouldSyncWindow(
- const SyncedWindowDelegate* window) {
- if (window->IsApp())
- return false;
- return window->IsTypeTabbed() || window->IsTypePopup();
-}
-