| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 96   if (!service) { | 96   if (!service) { | 
| 97     return PRE_SYNCED; | 97     return PRE_SYNCED; | 
| 98   } | 98   } | 
| 99 | 99 | 
| 100   if (service->HasSyncSetupCompleted()) { | 100   if (service->HasSyncSetupCompleted()) { | 
| 101     ProfileSyncService::Status status(service->QueryDetailedSyncStatus()); | 101     ProfileSyncService::Status status(service->QueryDetailedSyncStatus()); | 
| 102     const AuthError& auth_error = service->GetAuthError(); | 102     const AuthError& auth_error = service->GetAuthError(); | 
| 103 | 103 | 
| 104     // Either show auth error information with a link to re-login, auth in prog, | 104     // Either show auth error information with a link to re-login, auth in prog, | 
| 105     // or note that everything is OK with the last synced time. | 105     // or note that everything is OK with the last synced time. | 
| 106     if (status.authenticated && !service->ObservedPassphraseRequired()) { | 106     if (status.authenticated && !service->IsPassphraseRequired()) { | 
| 107       // Everything is peachy. | 107       // Everything is peachy. | 
| 108       if (status_label) { | 108       if (status_label) { | 
| 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->ObservedPassphraseRequired()) { | 118     } else if (service->IsPassphraseRequired()) { | 
| 119       if (service->passphrase_required_reason() == | 119       if (service->IsPassphraseRequiredForDecryption()) { | 
| 120               sync_api::REASON_DECRYPTION || |  | 
| 121           service->passphrase_required_reason() == |  | 
| 122               sync_api::REASON_SET_PASSPHRASE_FAILED) { |  | 
| 123         // NOT first machine. | 120         // NOT first machine. | 
| 124         // Show a link ("needs attention"), but still indicate the | 121         // Show a link ("needs attention"), but still indicate the | 
| 125         // current synced status.  Return SYNC_PROMO so that | 122         // current synced status.  Return SYNC_PROMO so that | 
| 126         // the configure link will still be shown. | 123         // the configure link will still be shown. | 
| 127         if (status_label && link_label) { | 124         if (status_label && link_label) { | 
| 128           status_label->assign(GetSyncedStateStatusLabel(service)); | 125           status_label->assign(GetSyncedStateStatusLabel(service)); | 
| 129           link_label->assign( | 126           link_label->assign( | 
| 130               l10n_util::GetStringUTF16(IDS_SYNC_PASSWORD_SYNC_ATTENTION)); | 127               l10n_util::GetStringUTF16(IDS_SYNC_PASSWORD_SYNC_ATTENTION)); | 
| 131         } | 128         } | 
| 132         result_type = SYNC_PROMO; | 129         result_type = SYNC_PROMO; | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 183 | 180 | 
| 184 // Returns the status info for use on the new tab page, where we want slightly | 181 // Returns the status info for use on the new tab page, where we want slightly | 
| 185 // different information than in the settings panel. | 182 // different information than in the settings panel. | 
| 186 MessageType GetStatusInfoForNewTabPage(ProfileSyncService* service, | 183 MessageType GetStatusInfoForNewTabPage(ProfileSyncService* service, | 
| 187                                        string16* status_label, | 184                                        string16* status_label, | 
| 188                                        string16* link_label) { | 185                                        string16* link_label) { | 
| 189   DCHECK(status_label); | 186   DCHECK(status_label); | 
| 190   DCHECK(link_label); | 187   DCHECK(link_label); | 
| 191 | 188 | 
| 192   if (service->HasSyncSetupCompleted() && | 189   if (service->HasSyncSetupCompleted() && | 
| 193       service->ObservedPassphraseRequired()) { | 190       service->IsPassphraseRequired()) { | 
| 194     if (service->passphrase_required_reason() == sync_api::REASON_ENCRYPTION) { | 191     if (service->passphrase_required_reason() == sync_api::REASON_ENCRYPTION) { | 
| 195       // First machine migrating to passwords.  Show as a promotion. | 192       // First machine migrating to passwords.  Show as a promotion. | 
| 196       if (status_label && link_label) { | 193       if (status_label && link_label) { | 
| 197         status_label->assign( | 194         status_label->assign( | 
| 198             l10n_util::GetStringFUTF16( | 195             l10n_util::GetStringFUTF16( | 
| 199                 IDS_SYNC_NTP_PASSWORD_PROMO, | 196                 IDS_SYNC_NTP_PASSWORD_PROMO, | 
| 200                 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 197                 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 
| 201         link_label->assign( | 198         link_label->assign( | 
| 202             l10n_util::GetStringUTF16(IDS_SYNC_NTP_PASSWORD_ENABLE)); | 199             l10n_util::GetStringUTF16(IDS_SYNC_NTP_PASSWORD_ENABLE)); | 
| 203       } | 200       } | 
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 438 | 435 | 
| 439       DictionaryValue* val = new DictionaryValue; | 436       DictionaryValue* val = new DictionaryValue; | 
| 440       val->SetString("stat_name", "Autofill Migration Time"); | 437       val->SetString("stat_name", "Autofill Migration Time"); | 
| 441       val->SetString("stat_value", ConstructTime(info.autofill_migration_time)); | 438       val->SetString("stat_value", ConstructTime(info.autofill_migration_time)); | 
| 442       details->Append(val); | 439       details->Append(val); | 
| 443     } | 440     } | 
| 444   } | 441   } | 
| 445 } | 442 } | 
| 446 | 443 | 
| 447 }  // namespace sync_ui_util | 444 }  // namespace sync_ui_util | 
| OLD | NEW | 
|---|