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(const std::string name) { | 560 void SessionModelAssociator::OnSessionNameInitialized( |
| 561 const std::string& name) { |
561 DCHECK(CalledOnValidThread()); | 562 DCHECK(CalledOnValidThread()); |
562 // Only use the default machine name if it hasn't already been set. | 563 // Only use the default machine name if it hasn't already been set. |
563 if (current_session_name_.empty()) | 564 if (current_session_name_.empty()) |
564 current_session_name_ = name; | 565 current_session_name_ = name; |
565 } | 566 } |
566 | 567 |
567 void SessionModelAssociator::InitializeCurrentSessionName() { | 568 void SessionModelAssociator::InitializeCurrentSessionName() { |
568 DCHECK(CalledOnValidThread()); | 569 DCHECK(CalledOnValidThread()); |
569 if (setup_for_test_) { | 570 if (setup_for_test_) { |
570 OnSessionNameInitialized("TestSessionName"); | 571 OnSessionNameInitialized("TestSessionName"); |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 bool SessionModelAssociator::CryptoReadyIfNecessary() { | 1251 bool SessionModelAssociator::CryptoReadyIfNecessary() { |
1251 // We only access the cryptographer while holding a transaction. | 1252 // We only access the cryptographer while holding a transaction. |
1252 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 1253 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
1253 const syncable::ModelTypeSet encrypted_types = | 1254 const syncable::ModelTypeSet encrypted_types = |
1254 sync_api::GetEncryptedTypes(&trans); | 1255 sync_api::GetEncryptedTypes(&trans); |
1255 return !encrypted_types.Has(SESSIONS) || | 1256 return !encrypted_types.Has(SESSIONS) || |
1256 sync_service_->IsCryptographerReady(&trans); | 1257 sync_service_->IsCryptographerReady(&trans); |
1257 } | 1258 } |
1258 | 1259 |
1259 } // namespace browser_sync | 1260 } // namespace browser_sync |
OLD | NEW |