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