summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd7
-rw-r--r--chrome/browser/dom_ui/new_tab_page_sync_handler.cc4
-rw-r--r--chrome/browser/sync/sync_ui_util.cc62
-rw-r--r--chrome/browser/sync/sync_ui_util.h5
4 files changed, 69 insertions, 9 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index e56a968d..9c1f903 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -8117,6 +8117,13 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_SYNC_CONFIGURE_ENCRYPTION" desc="Link to configure sync encryption for passwords">
Configure password sync.
</message>
+ <message name="IDS_SYNC_NEW_PASSWORD_SYNC" desc="Promotional message for password sync setup.">
+ New! Configure password sync.
+ </message>
+ <message name="IDS_SYNC_PASSWORD_SYNC_ATTENTION" desc="Message indicating password sync needs attention.">
+ Password sync needs your attention.
+ </message>
+
<message name="IDS_SYNC_PLEASE_SIGN_IN" desc="An title for a sign in dialog.">
Please sign in
</message>
diff --git a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
index c16aea4..96ab9f9 100644
--- a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
+++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
@@ -144,7 +144,9 @@ void NewTabPageSyncHandler::BuildAndSendSyncStatus() {
string16 status_msg;
string16 link_text;
sync_ui_util::MessageType type =
- sync_ui_util::GetStatusLabels(sync_service_, &status_msg, &link_text);
+ sync_ui_util::GetStatusLabelsForNewTabPage(sync_service_,
+ &status_msg,
+ &link_text);
SendSyncMessageToPage(FromSyncStatusMessageType(type),
UTF16ToUTF8(status_msg), UTF16ToUTF8(link_text));
}
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);
}
diff --git a/chrome/browser/sync/sync_ui_util.h b/chrome/browser/sync/sync_ui_util.h
index 95e3ac7..5ea41f3 100644
--- a/chrome/browser/sync/sync_ui_util.h
+++ b/chrome/browser/sync/sync_ui_util.h
@@ -39,6 +39,11 @@ MessageType GetStatusLabels(ProfileSyncService* service,
string16* status_label,
string16* link_label);
+// Same as above but for use specifically on the New Tab Page.
+MessageType GetStatusLabelsForNewTabPage(ProfileSyncService* service,
+ string16* status_label,
+ string16* link_label);
+
MessageType GetStatus(ProfileSyncService* service);
// Determines whether or not the sync error button should be visible.