summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-03 16:02:40 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-03 16:02:40 +0000
commite4925aa2cea0f4cc4ab8395bbde500d772e1a724 (patch)
treece560009b81d4966191d6cc7b707c20ecff80b5e /chrome/browser
parent65ed01e42abd1d73fd7eb520908bdff1b50c21fd (diff)
downloadchromium_src-e4925aa2cea0f4cc4ab8395bbde500d772e1a724.zip
chromium_src-e4925aa2cea0f4cc4ab8395bbde500d772e1a724.tar.gz
chromium_src-e4925aa2cea0f4cc4ab8395bbde500d772e1a724.tar.bz2
Notify user that Chrome is already synced if promo banner "sync me" link is clicked.
BUG= 28795 TEST= sync bookmarks, then click "sync" link in promo again. see notification that you are already synced. Review URL: http://codereview.chromium.org/462011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33685 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/dom_ui/new_tab_page_sync_handler.cc8
-rw-r--r--chrome/browser/dom_ui/ntp_resource_cache.cc1
-rw-r--r--chrome/browser/resources/new_new_tab.js9
3 files changed, 16 insertions, 2 deletions
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 1e494ae..ded338a 100644
--- a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
+++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/profile.h"
@@ -148,8 +149,11 @@ void NewTabPageSyncHandler::HandleSyncLinkClicked(const Value* value) {
DCHECK(!waiting_for_initial_page_load_);
DCHECK(sync_service_);
if (sync_service_->HasSyncSetupCompleted()) {
- // User clicked the 'Login again' link to re-authenticate.
- sync_service_->ShowLoginDialog();
+ DictionaryValue value;
+ value.SetString(L"syncEnabledMessage",
+ l10n_util::GetStringF(IDS_SYNC_NTP_SYNCED_TO,
+ UTF16ToWide(sync_service_->GetAuthenticatedUsername())));
+ dom_ui_->CallJavascriptFunction(L"syncAlreadyEnabled", value);
} else {
// User clicked the 'Start now' link to begin syncing.
ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP);
diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc
index 8f10ffe..2cbb282 100644
--- a/chrome/browser/dom_ui/ntp_resource_cache.cc
+++ b/chrome/browser/dom_ui/ntp_resource_cache.cc
@@ -349,6 +349,7 @@ void NTPResourceCache::CreateNewTabHTML() {
l10n_util::GetStringF(IDS_NTP_PROMO_MESSAGE,
l10n_util::GetString(IDS_PRODUCT_NAME), extensionLink));
localized_strings.SetString(L"extensionslink", extensionLink);
+ localized_strings.SetString(L"close", l10n_util::GetString(IDS_CLOSE));
// Don't initiate the sync related message passing with the page if the sync
// code is not present.
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index 7b60721..728a8d4 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -689,6 +689,15 @@ function syncSectionLinkClicked(e) {
}
/**
+ * Invoked when link to start sync in the promo message is clicked, and Chrome
+ * has already been synced to an account.
+ */
+function syncAlreadyEnabled(message) {
+ showNotification(message.syncEnabledMessage,
+ localStrings.getString('close'));
+}
+
+/**
* Returns the text used for a recently closed window.
* @param {number} numTabs Number of tabs in the window.
* @return {string} The text to use.