OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/about_sync_util.h" | 5 #include "chrome/browser/sync/about_sync_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/signin/signin_manager.h" | 11 #include "chrome/browser/signin/signin_manager.h" |
12 #include "chrome/browser/sync/profile_sync_service.h" | 12 #include "chrome/browser/sync/profile_sync_service.h" |
13 #include "chrome/common/chrome_version_info.h" | 13 #include "chrome/common/chrome_version_info.h" |
| 14 #include "sync/api/time.h" |
| 15 #include "sync/internal_api/public/util/sync_string_conversions.h" |
14 #include "sync/protocol/proto_enum_conversions.h" | 16 #include "sync/protocol/proto_enum_conversions.h" |
15 | 17 |
16 using base::DictionaryValue; | 18 using base::DictionaryValue; |
17 using base::ListValue; | 19 using base::ListValue; |
18 | 20 |
19 namespace { | 21 namespace { |
20 | 22 |
21 // Creates a 'section' for display on about:sync, consisting of a title and a | 23 // Creates a 'section' for display on about:sync, consisting of a title and a |
22 // list of fields. Returns a pointer to the new section. Note that | 24 // list of fields. Returns a pointer to the new section. Note that |
23 // |parent_list|, not the caller, owns the newly added section. | 25 // |parent_list|, not the caller, owns the newly added section. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 version_modifier = "-devel"; | 136 version_modifier = "-devel"; |
135 } | 137 } |
136 } else { | 138 } else { |
137 version_modifier = " " + version_modifier; | 139 version_modifier = " " + version_modifier; |
138 } | 140 } |
139 return chrome_version.Name() + " " + chrome_version.OSType() + " " + | 141 return chrome_version.Name() + " " + chrome_version.OSType() + " " + |
140 chrome_version.Version() + " (" + chrome_version.LastChange() + ")" + | 142 chrome_version.Version() + " (" + chrome_version.LastChange() + ")" + |
141 version_modifier; | 143 version_modifier; |
142 } | 144 } |
143 | 145 |
| 146 std::string GetKeystoreMigrationTimeStr(base::Time migration_time) { |
| 147 std::string migration_time_str; |
| 148 if (migration_time.is_null()) |
| 149 migration_time_str = "Not Migrated"; |
| 150 else |
| 151 migration_time_str = syncer::GetTimeDebugString(migration_time); |
| 152 return migration_time_str; |
| 153 } |
| 154 |
144 } // namespace | 155 } // namespace |
145 | 156 |
146 namespace sync_ui_util { | 157 namespace sync_ui_util { |
147 | 158 |
148 // This function both defines the structure of the message to be returned and | 159 // This function both defines the structure of the message to be returned and |
149 // its contents. Most of the message consists of simple fields in about:sync | 160 // its contents. Most of the message consists of simple fields in about:sync |
150 // which are grouped into sections and populated with the help of the SyncStat | 161 // which are grouped into sections and populated with the help of the SyncStat |
151 // classes defined above. | 162 // classes defined above. |
152 scoped_ptr<DictionaryValue> ConstructAboutInformation( | 163 scoped_ptr<DictionaryValue> ConstructAboutInformation( |
153 ProfileSyncService* service) { | 164 ProfileSyncService* service) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 ListValue* section_encryption = AddSection(stats_list, "Encryption"); | 197 ListValue* section_encryption = AddSection(stats_list, "Encryption"); |
187 BoolSyncStat is_using_explicit_passphrase(section_encryption, | 198 BoolSyncStat is_using_explicit_passphrase(section_encryption, |
188 "Explicit Passphrase"); | 199 "Explicit Passphrase"); |
189 BoolSyncStat is_passphrase_required(section_encryption, | 200 BoolSyncStat is_passphrase_required(section_encryption, |
190 "Passphrase Required"); | 201 "Passphrase Required"); |
191 BoolSyncStat is_cryptographer_ready(section_encryption, | 202 BoolSyncStat is_cryptographer_ready(section_encryption, |
192 "Cryptographer Ready"); | 203 "Cryptographer Ready"); |
193 BoolSyncStat has_pending_keys(section_encryption, | 204 BoolSyncStat has_pending_keys(section_encryption, |
194 "Cryptographer Has Pending Keys"); | 205 "Cryptographer Has Pending Keys"); |
195 StringSyncStat encrypted_types(section_encryption, "Encrypted Types"); | 206 StringSyncStat encrypted_types(section_encryption, "Encrypted Types"); |
| 207 BoolSyncStat has_keystore_key(section_encryption, "Has Keystore Key"); |
| 208 StringSyncStat keystore_migration_time(section_encryption, |
| 209 "Keystore Migration Time"); |
| 210 StringSyncStat passphrase_type(section_encryption, |
| 211 "Passphrase Type"); |
196 | 212 |
197 ListValue* section_last_session = AddSection( | 213 ListValue* section_last_session = AddSection( |
198 stats_list, "Status from Last Completed Session"); | 214 stats_list, "Status from Last Completed Session"); |
199 StringSyncStat session_source(section_last_session, "Sync Source"); | 215 StringSyncStat session_source(section_last_session, "Sync Source"); |
200 StringSyncStat get_key_result(section_last_session, "GetKey Step Result"); | 216 StringSyncStat get_key_result(section_last_session, "GetKey Step Result"); |
201 StringSyncStat download_result(section_last_session, "Download Step Result"); | 217 StringSyncStat download_result(section_last_session, "Download Step Result"); |
202 StringSyncStat commit_result(section_last_session, "Commit Step Result"); | 218 StringSyncStat commit_result(section_last_session, "Commit Step Result"); |
203 | 219 |
204 ListValue* section_counters = AddSection(stats_list, "Running Totals"); | 220 ListValue* section_counters = AddSection(stats_list, "Running Totals"); |
205 IntSyncStat notifications_received(section_counters, | 221 IntSyncStat notifications_received(section_counters, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 if (sync_initialized) { | 302 if (sync_initialized) { |
287 is_using_explicit_passphrase.SetValue( | 303 is_using_explicit_passphrase.SetValue( |
288 service->IsUsingSecondaryPassphrase()); | 304 service->IsUsingSecondaryPassphrase()); |
289 is_passphrase_required.SetValue(service->IsPassphraseRequired()); | 305 is_passphrase_required.SetValue(service->IsPassphraseRequired()); |
290 } | 306 } |
291 if (is_status_valid) { | 307 if (is_status_valid) { |
292 is_cryptographer_ready.SetValue(full_status.cryptographer_ready); | 308 is_cryptographer_ready.SetValue(full_status.cryptographer_ready); |
293 has_pending_keys.SetValue(full_status.crypto_has_pending_keys); | 309 has_pending_keys.SetValue(full_status.crypto_has_pending_keys); |
294 encrypted_types.SetValue( | 310 encrypted_types.SetValue( |
295 ModelTypeSetToString(full_status.encrypted_types)); | 311 ModelTypeSetToString(full_status.encrypted_types)); |
| 312 has_keystore_key.SetValue(full_status.has_keystore_key); |
| 313 keystore_migration_time.SetValue( |
| 314 GetKeystoreMigrationTimeStr(full_status.keystore_migration_time)); |
| 315 passphrase_type.SetValue( |
| 316 PassphraseTypeToString(full_status.passphrase_type)); |
296 } | 317 } |
297 | 318 |
298 if (snapshot.is_initialized()) { | 319 if (snapshot.is_initialized()) { |
299 session_source.SetValue( | 320 session_source.SetValue( |
300 syncer::GetUpdatesSourceString(snapshot.source().updates_source)); | 321 syncer::GetUpdatesSourceString(snapshot.source().updates_source)); |
301 get_key_result.SetValue( | 322 get_key_result.SetValue( |
302 GetSyncerErrorString( | 323 GetSyncerErrorString( |
303 snapshot.model_neutral_state().last_get_key_result)); | 324 snapshot.model_neutral_state().last_get_key_result)); |
304 download_result.SetValue( | 325 download_result.SetValue( |
305 GetSyncerErrorString( | 326 GetSyncerErrorString( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 about_info->SetString("unrecoverable_error_message", | 413 about_info->SetString("unrecoverable_error_message", |
393 unrecoverable_error_message); | 414 unrecoverable_error_message); |
394 } | 415 } |
395 | 416 |
396 about_info->Set("type_status", service->GetTypeStatusMap()); | 417 about_info->Set("type_status", service->GetTypeStatusMap()); |
397 | 418 |
398 return about_info.Pass(); | 419 return about_info.Pass(); |
399 } | 420 } |
400 | 421 |
401 } // namespace sync_ui_util | 422 } // namespace sync_ui_util |
OLD | NEW |