OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/internal_api/sync_manager.h" | 5 #include "chrome/browser/sync/internal_api/sync_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1961 UserShare* SyncManager::GetUserShare() const { | 1961 UserShare* SyncManager::GetUserShare() const { |
1962 return data_->GetUserShare(); | 1962 return data_->GetUserShare(); |
1963 } | 1963 } |
1964 | 1964 |
1965 void SyncManager::RefreshEncryption() { | 1965 void SyncManager::RefreshEncryption() { |
1966 if (data_->UpdateCryptographerFromNigori()) | 1966 if (data_->UpdateCryptographerFromNigori()) |
1967 data_->EncryptDataTypes(syncable::ModelTypeSet()); | 1967 data_->EncryptDataTypes(syncable::ModelTypeSet()); |
1968 } | 1968 } |
1969 | 1969 |
1970 syncable::ModelTypeSet SyncManager::GetEncryptedDataTypes() const { | 1970 syncable::ModelTypeSet SyncManager::GetEncryptedDataTypes() const { |
1971 sync_api::ReadTransaction trans(FROM_HERE, GetUserShare()); | 1971 ReadTransaction trans(FROM_HERE, GetUserShare()); |
1972 return GetEncryptedTypes(&trans); | 1972 return GetEncryptedTypes(&trans); |
1973 } | 1973 } |
1974 | 1974 |
| 1975 bool SyncManager::ReceivedExperimentalTypes(syncable::ModelTypeSet* to_add) |
| 1976 const { |
| 1977 ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 1978 ReadNode node(&trans); |
| 1979 if (!node.InitByTagLookup(kNigoriTag)) { |
| 1980 VLOG(1) << "Couldn't find Nigori node."; |
| 1981 return false; |
| 1982 } |
| 1983 if (node.GetNigoriSpecifics().sync_tabs()) { |
| 1984 to_add->insert(syncable::SESSIONS); |
| 1985 return true; |
| 1986 } |
| 1987 return false; |
| 1988 } |
| 1989 |
1975 bool SyncManager::HasUnsyncedItems() const { | 1990 bool SyncManager::HasUnsyncedItems() const { |
1976 sync_api::ReadTransaction trans(FROM_HERE, GetUserShare()); | 1991 sync_api::ReadTransaction trans(FROM_HERE, GetUserShare()); |
1977 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); | 1992 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); |
1978 } | 1993 } |
1979 | 1994 |
1980 void SyncManager::LogUnsyncedItems(int level) const { | 1995 void SyncManager::LogUnsyncedItems(int level) const { |
1981 std::vector<int64> unsynced_handles; | 1996 std::vector<int64> unsynced_handles; |
1982 sync_api::ReadTransaction trans(FROM_HERE, GetUserShare()); | 1997 sync_api::ReadTransaction trans(FROM_HERE, GetUserShare()); |
1983 trans.GetWrappedTrans()->directory()->GetUnsyncedMetaHandles( | 1998 trans.GetWrappedTrans()->directory()->GetUnsyncedMetaHandles( |
1984 trans.GetWrappedTrans(), &unsynced_handles); | 1999 trans.GetWrappedTrans(), &unsynced_handles); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 | 2054 |
2040 for (syncable::ModelTypeSet::const_iterator i = types.begin(); | 2055 for (syncable::ModelTypeSet::const_iterator i = types.begin(); |
2041 i != types.end(); ++i) { | 2056 i != types.end(); ++i) { |
2042 if (!lookup->initial_sync_ended_for_type(*i)) | 2057 if (!lookup->initial_sync_ended_for_type(*i)) |
2043 return false; | 2058 return false; |
2044 } | 2059 } |
2045 return true; | 2060 return true; |
2046 } | 2061 } |
2047 | 2062 |
2048 } // namespace sync_api | 2063 } // namespace sync_api |
OLD | NEW |