| 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() == | 
|  | 120               sync_api::REASON_DECRYPTION || | 
|  | 121           service->passphrase_required_reason() == | 
|  | 122               sync_api::REASON_SET_PASSPHRASE_FAILED) { | 
| 120         // NOT first machine. | 123         // NOT first machine. | 
| 121         // Show a link ("needs attention"), but still indicate the | 124         // Show a link ("needs attention"), but still indicate the | 
| 122         // current synced status.  Return SYNC_PROMO so that | 125         // current synced status.  Return SYNC_PROMO so that | 
| 123         // the configure link will still be shown. | 126         // the configure link will still be shown. | 
| 124         if (status_label && link_label) { | 127         if (status_label && link_label) { | 
| 125           status_label->assign(GetSyncedStateStatusLabel(service)); | 128           status_label->assign(GetSyncedStateStatusLabel(service)); | 
| 126           link_label->assign( | 129           link_label->assign( | 
| 127               l10n_util::GetStringUTF16(IDS_SYNC_PASSWORD_SYNC_ATTENTION)); | 130               l10n_util::GetStringUTF16(IDS_SYNC_PASSWORD_SYNC_ATTENTION)); | 
| 128         } | 131         } | 
| 129         result_type = SYNC_PROMO; | 132         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 | 184 // Returns the status info for use on the new tab page, where we want slightly | 
| 182 // different information than in the settings panel. | 185 // different information than in the settings panel. | 
| 183 MessageType GetStatusInfoForNewTabPage(ProfileSyncService* service, | 186 MessageType GetStatusInfoForNewTabPage(ProfileSyncService* service, | 
| 184                                        string16* status_label, | 187                                        string16* status_label, | 
| 185                                        string16* link_label) { | 188                                        string16* link_label) { | 
| 186   DCHECK(status_label); | 189   DCHECK(status_label); | 
| 187   DCHECK(link_label); | 190   DCHECK(link_label); | 
| 188 | 191 | 
| 189   if (service->HasSyncSetupCompleted() && | 192   if (service->HasSyncSetupCompleted() && | 
| 190       service->observed_passphrase_required()) { | 193       service->observed_passphrase_required()) { | 
| 191     if (!service->passphrase_required_for_decryption()) { | 194     if (service->passphrase_required_reason() != sync_api::REASON_DECRYPTION && | 
|  | 195         service->passphrase_required_reason() != | 
|  | 196             sync_api::REASON_SET_PASSPHRASE_FAILED) { | 
| 192       // First machine migrating to passwords.  Show as a promotion. | 197       // First machine migrating to passwords.  Show as a promotion. | 
| 193       if (status_label && link_label) { | 198       if (status_label && link_label) { | 
| 194         status_label->assign( | 199         status_label->assign( | 
| 195             l10n_util::GetStringFUTF16( | 200             l10n_util::GetStringFUTF16( | 
| 196                 IDS_SYNC_NTP_PASSWORD_PROMO, | 201                 IDS_SYNC_NTP_PASSWORD_PROMO, | 
| 197                 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 202                 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 
| 198         link_label->assign( | 203         link_label->assign( | 
| 199             l10n_util::GetStringUTF16(IDS_SYNC_NTP_PASSWORD_ENABLE)); | 204             l10n_util::GetStringUTF16(IDS_SYNC_NTP_PASSWORD_ENABLE)); | 
| 200       } | 205       } | 
| 201       return SYNC_PROMO; | 206       return SYNC_PROMO; | 
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 433 | 438 | 
| 434       DictionaryValue* val = new DictionaryValue; | 439       DictionaryValue* val = new DictionaryValue; | 
| 435       val->SetString("stat_name", "Autofill Migration Time"); | 440       val->SetString("stat_name", "Autofill Migration Time"); | 
| 436       val->SetString("stat_value", ConstructTime(info.autofill_migration_time)); | 441       val->SetString("stat_value", ConstructTime(info.autofill_migration_time)); | 
| 437       details->Append(val); | 442       details->Append(val); | 
| 438     } | 443     } | 
| 439   } | 444   } | 
| 440 } | 445 } | 
| 441 | 446 | 
| 442 }  // namespace sync_ui_util | 447 }  // namespace sync_ui_util | 
| OLD | NEW | 
|---|