summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/sync_ui_util.cc
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 19:23:14 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 19:23:14 +0000
commita68dfce63e3ea34605e423f9fa1f8787f3d213ff (patch)
tree45c0099857202dfff3e50484dd1b23a5691b3533 /chrome/browser/sync/sync_ui_util.cc
parent9e63fded0cfe8c190294f5f26137afda39cbf3f2 (diff)
downloadchromium_src-a68dfce63e3ea34605e423f9fa1f8787f3d213ff.zip
chromium_src-a68dfce63e3ea34605e423f9fa1f8787f3d213ff.tar.gz
chromium_src-a68dfce63e3ea34605e423f9fa1f8787f3d213ff.tar.bz2
Create a new code path to generate sync strings for the new tab page different from those used on the settings' page.
This will allow us to show on the settings page the current sync status as well as a message regarding passwords. BUG=69622 TEST=see bug Review URL: http://codereview.chromium.org/6350008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72171 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/sync_ui_util.cc')
-rw-r--r--chrome/browser/sync/sync_ui_util.cc62
1 files changed, 54 insertions, 8 deletions
diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc
index b4eb6f1..fd71497 100644
--- a/chrome/browser/sync/sync_ui_util.cc
+++ b/chrome/browser/sync/sync_ui_util.cc
@@ -107,21 +107,21 @@ MessageType GetStatusInfo(ProfileSyncService* service,
} else if (service->observed_passphrase_required()) {
if (service->passphrase_required_for_decryption()) {
// NOT first machine.
- // Show a link and present as an error ("needs attention").
+ // Show a link ("needs attention"), but still indicate the
+ // current synced status. Return SYNC_PROMO so that
+ // the configure link will still be shown.
if (status_label && link_label) {
- status_label->assign(string16());
+ status_label->assign(GetSyncedStateStatusLabel(service));
link_label->assign(
- l10n_util::GetStringUTF16(IDS_SYNC_CONFIGURE_ENCRYPTION));
+ l10n_util::GetStringUTF16(IDS_SYNC_PASSWORD_SYNC_ATTENTION));
}
- result_type = SYNC_ERROR;
+ result_type = SYNC_PROMO;
} else {
// First machine. Show as a promotion.
if (status_label && link_label) {
- status_label->assign(
- l10n_util::GetStringFUTF16(IDS_SYNC_NTP_PASSWORD_PROMO,
- l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
+ status_label->assign(GetSyncedStateStatusLabel(service));
link_label->assign(
- l10n_util::GetStringUTF16(IDS_SYNC_NTP_PASSWORD_ENABLE));
+ l10n_util::GetStringUTF16(IDS_SYNC_NEW_PASSWORD_SYNC));
}
result_type = SYNC_PROMO;
}
@@ -176,6 +176,43 @@ MessageType GetStatusInfo(ProfileSyncService* service,
return result_type;
}
+// Returns the status info for use on the new tab page, where we want slightly
+// different information than in the settings panel.
+MessageType GetStatusInfoForNewTabPage(ProfileSyncService* service,
+ string16* status_label,
+ string16* link_label) {
+ DCHECK(status_label);
+ DCHECK(link_label);
+
+ if (service->HasSyncSetupCompleted() &&
+ service->observed_passphrase_required()) {
+ if (!service->passphrase_required_for_decryption()) {
+ // First machine migrating to passwords. Show as a promotion.
+ if (status_label && link_label) {
+ status_label->assign(
+ l10n_util::GetStringFUTF16(
+ IDS_SYNC_NTP_PASSWORD_PROMO,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
+ link_label->assign(
+ l10n_util::GetStringUTF16(IDS_SYNC_NTP_PASSWORD_ENABLE));
+ }
+ return SYNC_PROMO;
+ } else {
+ // NOT first machine.
+ // Show a link and present as an error ("needs attention").
+ if (status_label && link_label) {
+ status_label->assign(string16());
+ link_label->assign(
+ l10n_util::GetStringUTF16(IDS_SYNC_CONFIGURE_ENCRYPTION));
+ }
+ return SYNC_ERROR;
+ }
+ }
+
+ // Fallback to default.
+ return GetStatusInfo(service, status_label, link_label);
+}
+
} // namespace
// Returns an HTML chunk for a login prompt related to encryption.
@@ -200,6 +237,15 @@ MessageType GetStatusLabels(ProfileSyncService* service,
return sync_ui_util::GetStatusInfo(service, status_label, link_label);
}
+MessageType GetStatusLabelsForNewTabPage(ProfileSyncService* service,
+ string16* status_label,
+ string16* link_label) {
+ DCHECK(status_label);
+ DCHECK(link_label);
+ return sync_ui_util::GetStatusInfoForNewTabPage(
+ service, status_label, link_label);
+}
+
MessageType GetStatus(ProfileSyncService* service) {
return sync_ui_util::GetStatusInfo(service, NULL, NULL);
}