| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 // a pre-existing node that has encryption issues. But, since we can't | 657 // a pre-existing node that has encryption issues. But, since we can't |
| 658 // load the item, we can't remove it, and error out at this point. | 658 // load the item, we can't remove it, and error out at this point. |
| 659 return error_handler_->CreateAndUploadError( | 659 return error_handler_->CreateAndUploadError( |
| 660 FROM_HERE, | 660 FROM_HERE, |
| 661 "Failed to create sessions header sync node.", | 661 "Failed to create sessions header sync node.", |
| 662 model_type()); | 662 model_type()); |
| 663 } | 663 } |
| 664 | 664 |
| 665 // Write the initial values to the specifics so that in case of a crash or | 665 // Write the initial values to the specifics so that in case of a crash or |
| 666 // error we don't persist a half-written node. | 666 // error we don't persist a half-written node. |
| 667 write_node.SetTitle(UTF8ToWide(current_machine_tag_)); | 667 write_node.SetTitle(base::UTF8ToWide(current_machine_tag_)); |
| 668 sync_pb::SessionSpecifics base_specifics; | 668 sync_pb::SessionSpecifics base_specifics; |
| 669 base_specifics.set_session_tag(current_machine_tag_); | 669 base_specifics.set_session_tag(current_machine_tag_); |
| 670 sync_pb::SessionHeader* header_s = base_specifics.mutable_header(); | 670 sync_pb::SessionHeader* header_s = base_specifics.mutable_header(); |
| 671 header_s->set_client_name(current_session_name_); | 671 header_s->set_client_name(current_session_name_); |
| 672 header_s->set_device_type(DeviceInfo::GetLocalDeviceType()); | 672 header_s->set_device_type(DeviceInfo::GetLocalDeviceType()); |
| 673 write_node.SetSessionSpecifics(base_specifics); | 673 write_node.SetSessionSpecifics(base_specifics); |
| 674 | 674 |
| 675 local_session_syncid_ = write_node.GetId(); | 675 local_session_syncid_ = write_node.GetId(); |
| 676 } | 676 } |
| 677 #if defined(OS_ANDROID) | 677 #if defined(OS_ANDROID) |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 | 1253 |
| 1254 bool SessionModelAssociator::CryptoReadyIfNecessary() { | 1254 bool SessionModelAssociator::CryptoReadyIfNecessary() { |
| 1255 // We only access the cryptographer while holding a transaction. | 1255 // We only access the cryptographer while holding a transaction. |
| 1256 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 1256 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
| 1257 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); | 1257 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); |
| 1258 return !encrypted_types.Has(SESSIONS) || | 1258 return !encrypted_types.Has(SESSIONS) || |
| 1259 sync_service_->IsCryptographerReady(&trans); | 1259 sync_service_->IsCryptographerReady(&trans); |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 } // namespace browser_sync | 1262 } // namespace browser_sync |
| OLD | NEW |