| 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/profile_sync_service_harness.h" | 5 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <ostream> | 10 #include <ostream> |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 << kLiveSyncOperationTimeoutMs / 1000 | 1103 << kLiveSyncOperationTimeoutMs / 1000 |
| 1104 << " seconds."; | 1104 << " seconds."; |
| 1105 return false; | 1105 return false; |
| 1106 } | 1106 } |
| 1107 return IsTypeEncrypted(type); | 1107 return IsTypeEncrypted(type); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 bool ProfileSyncServiceHarness::IsTypeEncrypted(syncable::ModelType type) { | 1110 bool ProfileSyncServiceHarness::IsTypeEncrypted(syncable::ModelType type) { |
| 1111 syncable::ModelTypeSet encrypted_types; | 1111 syncable::ModelTypeSet encrypted_types; |
| 1112 service_->GetEncryptedDataTypes(&encrypted_types); | 1112 service_->GetEncryptedDataTypes(&encrypted_types); |
| 1113 return (encrypted_types.count(type) != 0); | 1113 bool is_type_encrypted = (encrypted_types.count(type) != 0); |
| 1114 VLOG(2) << syncable::ModelTypeToString(type) << " is " |
| 1115 << (is_type_encrypted ? "" : "not ") << "encrypted; " |
| 1116 << "encrypted types = " |
| 1117 << syncable::ModelTypeSetToString(encrypted_types); |
| 1118 return is_type_encrypted; |
| 1114 } | 1119 } |
| 1115 | 1120 |
| 1116 bool ProfileSyncServiceHarness::IsTypeRunning(syncable::ModelType type) { | 1121 bool ProfileSyncServiceHarness::IsTypeRunning(syncable::ModelType type) { |
| 1117 browser_sync::DataTypeController::StateMap state_map; | 1122 browser_sync::DataTypeController::StateMap state_map; |
| 1118 service_->GetDataTypeControllerStates(&state_map); | 1123 service_->GetDataTypeControllerStates(&state_map); |
| 1119 return (state_map.count(type) != 0 && | 1124 return (state_map.count(type) != 0 && |
| 1120 state_map[type] == browser_sync::DataTypeController::RUNNING); | 1125 state_map[type] == browser_sync::DataTypeController::RUNNING); |
| 1121 } | 1126 } |
| 1122 | 1127 |
| 1123 bool ProfileSyncServiceHarness::IsTypePreferred(syncable::ModelType type) { | 1128 bool ProfileSyncServiceHarness::IsTypePreferred(syncable::ModelType type) { |
| 1124 syncable::ModelTypeSet synced_types; | 1129 syncable::ModelTypeSet synced_types; |
| 1125 service_->GetPreferredDataTypes(&synced_types); | 1130 service_->GetPreferredDataTypes(&synced_types); |
| 1126 return (synced_types.count(type) != 0); | 1131 return (synced_types.count(type) != 0); |
| 1127 } | 1132 } |
| 1128 | 1133 |
| 1129 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1134 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
| 1130 DictionaryValue value; | 1135 DictionaryValue value; |
| 1131 sync_ui_util::ConstructAboutInformation(service_, &value); | 1136 sync_ui_util::ConstructAboutInformation(service_, &value); |
| 1132 std::string service_status; | 1137 std::string service_status; |
| 1133 base::JSONWriter::Write(&value, true, &service_status); | 1138 base::JSONWriter::Write(&value, true, &service_status); |
| 1134 return service_status; | 1139 return service_status; |
| 1135 } | 1140 } |
| OLD | NEW |