| 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/sync_ui_util.h" | 5 #include "chrome/browser/sync/sync_ui_util.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
| 9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 status_label->assign(GetSyncedStateStatusLabel(service)); | 109 status_label->assign(GetSyncedStateStatusLabel(service)); |
| 110 } | 110 } |
| 111 DCHECK_EQ(auth_error.state(), AuthError::NONE); | 111 DCHECK_EQ(auth_error.state(), AuthError::NONE); |
| 112 } else if (service->UIShouldDepictAuthInProgress()) { | 112 } else if (service->UIShouldDepictAuthInProgress()) { |
| 113 if (status_label) { | 113 if (status_label) { |
| 114 status_label->assign( | 114 status_label->assign( |
| 115 l10n_util::GetStringUTF16(IDS_SYNC_AUTHENTICATING_LABEL)); | 115 l10n_util::GetStringUTF16(IDS_SYNC_AUTHENTICATING_LABEL)); |
| 116 } | 116 } |
| 117 result_type = PRE_SYNCED; | 117 result_type = PRE_SYNCED; |
| 118 } else if (service->observed_passphrase_required()) { | 118 } else if (service->observed_passphrase_required()) { |
| 119 if (service->passphrase_required_for_decryption()) { | 119 if (service->passphrase_required_reason() == sync_api::DECRYPTION || |
| 120 service->passphrase_required_reason() == |
| 121 sync_api::DECRYPTION_FAILED) { |
| 120 // NOT first machine. | 122 // NOT first machine. |
| 121 // Show a link ("needs attention"), but still indicate the | 123 // Show a link ("needs attention"), but still indicate the |
| 122 // current synced status. Return SYNC_PROMO so that | 124 // current synced status. Return SYNC_PROMO so that |
| 123 // the configure link will still be shown. | 125 // the configure link will still be shown. |
| 124 if (status_label && link_label) { | 126 if (status_label && link_label) { |
| 125 status_label->assign(GetSyncedStateStatusLabel(service)); | 127 status_label->assign(GetSyncedStateStatusLabel(service)); |
| 126 link_label->assign( | 128 link_label->assign( |
| 127 l10n_util::GetStringUTF16(IDS_SYNC_PASSWORD_SYNC_ATTENTION)); | 129 l10n_util::GetStringUTF16(IDS_SYNC_PASSWORD_SYNC_ATTENTION)); |
| 128 } | 130 } |
| 129 result_type = SYNC_PROMO; | 131 result_type = SYNC_PROMO; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // Returns the status info for use on the new tab page, where we want slightly | 183 // Returns the status info for use on the new tab page, where we want slightly |
| 182 // different information than in the settings panel. | 184 // different information than in the settings panel. |
| 183 MessageType GetStatusInfoForNewTabPage(ProfileSyncService* service, | 185 MessageType GetStatusInfoForNewTabPage(ProfileSyncService* service, |
| 184 string16* status_label, | 186 string16* status_label, |
| 185 string16* link_label) { | 187 string16* link_label) { |
| 186 DCHECK(status_label); | 188 DCHECK(status_label); |
| 187 DCHECK(link_label); | 189 DCHECK(link_label); |
| 188 | 190 |
| 189 if (service->HasSyncSetupCompleted() && | 191 if (service->HasSyncSetupCompleted() && |
| 190 service->observed_passphrase_required()) { | 192 service->observed_passphrase_required()) { |
| 191 if (!service->passphrase_required_for_decryption()) { | 193 if (!(service->passphrase_required_reason() == sync_api::DECRYPTION && |
| 194 service->passphrase_required_reason() == |
| 195 sync_api::DECRYPTION_FAILED)) { |
| 192 // First machine migrating to passwords. Show as a promotion. | 196 // First machine migrating to passwords. Show as a promotion. |
| 193 if (status_label && link_label) { | 197 if (status_label && link_label) { |
| 194 status_label->assign( | 198 status_label->assign( |
| 195 l10n_util::GetStringFUTF16( | 199 l10n_util::GetStringFUTF16( |
| 196 IDS_SYNC_NTP_PASSWORD_PROMO, | 200 IDS_SYNC_NTP_PASSWORD_PROMO, |
| 197 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 201 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
| 198 link_label->assign( | 202 link_label->assign( |
| 199 l10n_util::GetStringUTF16(IDS_SYNC_NTP_PASSWORD_ENABLE)); | 203 l10n_util::GetStringUTF16(IDS_SYNC_NTP_PASSWORD_ENABLE)); |
| 200 } | 204 } |
| 201 return SYNC_PROMO; | 205 return SYNC_PROMO; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 | 437 |
| 434 DictionaryValue* val = new DictionaryValue; | 438 DictionaryValue* val = new DictionaryValue; |
| 435 val->SetString("stat_name", "Autofill Migration Time"); | 439 val->SetString("stat_name", "Autofill Migration Time"); |
| 436 val->SetString("stat_value", ConstructTime(info.autofill_migration_time)); | 440 val->SetString("stat_value", ConstructTime(info.autofill_migration_time)); |
| 437 details->Append(val); | 441 details->Append(val); |
| 438 } | 442 } |
| 439 } | 443 } |
| 440 } | 444 } |
| 441 | 445 |
| 442 } // namespace sync_ui_util | 446 } // namespace sync_ui_util |
| OLD | NEW |