| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 DCHECK(CalledOnValidThread()); | 834 DCHECK(CalledOnValidThread()); |
| 835 DCHECK(current_machine_tag_.empty()); | 835 DCHECK(current_machine_tag_.empty()); |
| 836 std::string persisted_guid; | 836 std::string persisted_guid; |
| 837 if (pref_service_) | 837 if (pref_service_) |
| 838 persisted_guid = pref_service_->GetString(kSyncSessionsGUID); | 838 persisted_guid = pref_service_->GetString(kSyncSessionsGUID); |
| 839 if (!persisted_guid.empty()) { | 839 if (!persisted_guid.empty()) { |
| 840 current_machine_tag_ = persisted_guid; | 840 current_machine_tag_ = persisted_guid; |
| 841 DVLOG(1) << "Restoring persisted session sync guid: " | 841 DVLOG(1) << "Restoring persisted session sync guid: " |
| 842 << persisted_guid; | 842 << persisted_guid; |
| 843 } else { | 843 } else { |
| 844 syncable::Directory* dir = trans->GetWrappedWriteTrans()->directory(); | 844 syncer::syncable::Directory* dir = |
| 845 trans->GetWrappedWriteTrans()->directory(); |
| 845 current_machine_tag_ = "session_sync"; | 846 current_machine_tag_ = "session_sync"; |
| 846 current_machine_tag_.append(dir->cache_guid()); | 847 current_machine_tag_.append(dir->cache_guid()); |
| 847 DVLOG(1) << "Creating session sync guid: " << current_machine_tag_; | 848 DVLOG(1) << "Creating session sync guid: " << current_machine_tag_; |
| 848 if (pref_service_) | 849 if (pref_service_) |
| 849 pref_service_->SetString(kSyncSessionsGUID, current_machine_tag_); | 850 pref_service_->SetString(kSyncSessionsGUID, current_machine_tag_); |
| 850 } | 851 } |
| 851 | 852 |
| 852 tab_pool_.set_machine_tag(current_machine_tag_); | 853 tab_pool_.set_machine_tag(current_machine_tag_); |
| 853 } | 854 } |
| 854 | 855 |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 bool SessionModelAssociator::CryptoReadyIfNecessary() { | 1581 bool SessionModelAssociator::CryptoReadyIfNecessary() { |
| 1581 // We only access the cryptographer while holding a transaction. | 1582 // We only access the cryptographer while holding a transaction. |
| 1582 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 1583 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
| 1583 const syncable::ModelTypeSet encrypted_types = | 1584 const syncable::ModelTypeSet encrypted_types = |
| 1584 syncer::GetEncryptedTypes(&trans); | 1585 syncer::GetEncryptedTypes(&trans); |
| 1585 return !encrypted_types.Has(SESSIONS) || | 1586 return !encrypted_types.Has(SESSIONS) || |
| 1586 sync_service_->IsCryptographerReady(&trans); | 1587 sync_service_->IsCryptographerReady(&trans); |
| 1587 } | 1588 } |
| 1588 | 1589 |
| 1589 } // namespace browser_sync | 1590 } // namespace browser_sync |
| OLD | NEW |