| 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/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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 void SessionModelAssociator::InitializeCurrentMachineTag( | 547 void SessionModelAssociator::InitializeCurrentMachineTag( |
| 548 sync_api::WriteTransaction* trans) { | 548 sync_api::WriteTransaction* trans) { |
| 549 DCHECK(CalledOnValidThread()); | 549 DCHECK(CalledOnValidThread()); |
| 550 syncable::Directory* dir = trans->GetWrappedWriteTrans()->directory(); | 550 syncable::Directory* dir = trans->GetWrappedWriteTrans()->directory(); |
| 551 current_machine_tag_ = "session_sync"; | 551 current_machine_tag_ = "session_sync"; |
| 552 current_machine_tag_.append(dir->cache_guid()); | 552 current_machine_tag_.append(dir->cache_guid()); |
| 553 DVLOG(1) << "Creating machine tag: " << current_machine_tag_; | 553 DVLOG(1) << "Creating machine tag: " << current_machine_tag_; |
| 554 tab_pool_.set_machine_tag(current_machine_tag_); | 554 tab_pool_.set_machine_tag(current_machine_tag_); |
| 555 } | 555 } |
| 556 | 556 |
| 557 void SessionModelAssociator::OnSessionNameInitialized(const std::string name) { | 557 void SessionModelAssociator::OnSessionNameInitialized( |
| 558 const std::string& name) { |
| 558 DCHECK(CalledOnValidThread()); | 559 DCHECK(CalledOnValidThread()); |
| 559 // Only use the default machine name if it hasn't already been set. | 560 // Only use the default machine name if it hasn't already been set. |
| 560 if (current_session_name_.empty()) | 561 if (current_session_name_.empty()) |
| 561 current_session_name_ = name; | 562 current_session_name_ = name; |
| 562 } | 563 } |
| 563 | 564 |
| 564 void SessionModelAssociator::InitializeCurrentSessionName() { | 565 void SessionModelAssociator::InitializeCurrentSessionName() { |
| 565 DCHECK(CalledOnValidThread()); | 566 DCHECK(CalledOnValidThread()); |
| 566 if (setup_for_test_) { | 567 if (setup_for_test_) { |
| 567 OnSessionNameInitialized("TestSessionName"); | 568 OnSessionNameInitialized("TestSessionName"); |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1247 bool SessionModelAssociator::CryptoReadyIfNecessary() { | 1248 bool SessionModelAssociator::CryptoReadyIfNecessary() { |
| 1248 // We only access the cryptographer while holding a transaction. | 1249 // We only access the cryptographer while holding a transaction. |
| 1249 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 1250 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
| 1250 const syncable::ModelEnumSet encrypted_types = | 1251 const syncable::ModelEnumSet encrypted_types = |
| 1251 sync_api::GetEncryptedTypes(&trans); | 1252 sync_api::GetEncryptedTypes(&trans); |
| 1252 return !encrypted_types.Has(SESSIONS) || | 1253 return !encrypted_types.Has(SESSIONS) || |
| 1253 sync_service_->IsCryptographerReady(&trans); | 1254 sync_service_->IsCryptographerReady(&trans); |
| 1254 } | 1255 } |
| 1255 | 1256 |
| 1256 } // namespace browser_sync | 1257 } // namespace browser_sync |
| OLD | NEW |