summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/chromium_strings.grd3
-rw-r--r--chrome/app/google_chrome_strings.grd3
-rw-r--r--chrome/browser/resources/sync_setup_overlay.html4
-rw-r--r--chrome/browser/resources/sync_setup_overlay.js18
-rw-r--r--chrome/browser/ui/webui/sync_setup_handler.cc9
5 files changed, 37 insertions, 0 deletions
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd
index f31cd9a..f35db25b 100644
--- a/chrome/app/chromium_strings.grd
+++ b/chrome/app/chromium_strings.grd
@@ -804,6 +804,9 @@ For Chromium, processes used to display diagnostics information (such as this "a
<message name="IDS_SYNC_PROMO_V_LEARN_MORE" desc="Learn more link at the bottom of the sync promo.">
See <ph name="BEGIN_LINK">&lt;a target="_blank" href="$1"&gt;</ph>more benefits<ph name="END_LINK">&lt;/a&gt;</ph> of signing in to Chromium.
</message>
+ <message name="IDS_SYNC_DIFFERENT_EMAIL" desc="Error message to display when setting up sync for a second time and the user name is different from the previous user name.">
+ You were previously signed in with a different account, signing in will merge your data. Consider creating a new Chromium user via the <ph name="BEGIN_LINK">&lt;a href="chrome://settings/search#Users"&gt;</ph>settings page<ph name="END_LINK">&lt;/a&gt;</ph> for your Chromium stuff.
+ </message>
<!-- One click sign in infobar -->
<if expr="not pp_ifdef('chromeos')">
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd
index 3a9a767..800cc82 100644
--- a/chrome/app/google_chrome_strings.grd
+++ b/chrome/app/google_chrome_strings.grd
@@ -728,6 +728,9 @@ For Google Chrome, processes used to display diagnostics information (such as th
<message name="IDS_SYNC_PROMO_V_LEARN_MORE" desc="Learn more link at the bottom of the sync promo.">
See <ph name="BEGIN_LINK">&lt;a target="_blank" href="$1"&gt;</ph>more benefits<ph name="END_LINK">&lt;/a&gt;</ph> of signing in to Chrome.
</message>
+ <message name="IDS_SYNC_DIFFERENT_EMAIL" desc="Error message to display when setting up sync for a second time and the user name is different from the previous user name.">
+ You were previously signed in with a different account, signing in will merge your data. Consider creating a new Chrome user via the <ph name="BEGIN_LINK">&lt;a href="chrome://settings/search#Users"&gt;</ph>settings page<ph name="END_LINK">&lt;/a&gt;</ph> for your Chrome stuff.
+ </message>
<!-- One click sign in infobar -->
<if expr="not pp_ifdef('chromeos')">
diff --git a/chrome/browser/resources/sync_setup_overlay.html b/chrome/browser/resources/sync_setup_overlay.html
index 86bfecc..0003d7f 100644
--- a/chrome/browser/resources/sync_setup_overlay.html
+++ b/chrome/browser/resources/sync_setup_overlay.html
@@ -76,6 +76,10 @@
<a i18n-values="href:invalidPasswordHelpURL" class="help-link"
target="_blank">?</a>
</div>
+ <div id="errormsg-different-email" class="errormsg reset-hidden"
+ hidden>
+ <span id="different-email"></span>
+ </div>
<div id="errormsg-fatal" class="errormsg reset-hidden" hidden>
<span i18n-content="unrecoverableError"></span>
<a i18n-values="href:unrecoverableErrorHelpURL"
diff --git a/chrome/browser/resources/sync_setup_overlay.js b/chrome/browser/resources/sync_setup_overlay.js
index a17b52d..cd7f127 100644
--- a/chrome/browser/resources/sync_setup_overlay.js
+++ b/chrome/browser/resources/sync_setup_overlay.js
@@ -30,6 +30,11 @@ cr.define('options', function() {
// each other).
var keystoreEncryptionEnabled_ = false;
+ // The last email address that this profile was connected to. If the profile
+ // was never connected this is an empty string. Otherwise it is a normalized
+ // email address.
+ var lastEmailAddress_ = '';
+
/**
* SyncSetupOverlay class
* Encapsulated handling of the 'Sync Setup' overlay page.
@@ -82,6 +87,7 @@ cr.define('options', function() {
chrome.send('SyncSetupStopSyncing');
self.closeOverlay_();
};
+ $('different-email').innerHTML = loadTimeData.getString('differentEmail');
},
showOverlay_: function() {
@@ -751,6 +757,7 @@ cr.define('options', function() {
$('sync-setup-login').hidden = false;
this.allowEmptyPassword_ = false;
this.captchaChallengeActive_ = false;
+ this.lastEmailAddress_ = args.lastEmailAddress;
var f = $('gaia-login-form');
var email = $('gaia-email');
@@ -816,6 +823,7 @@ cr.define('options', function() {
$('errormsg-0-email').hidden = true;
$('errormsg-0-password').hidden = true;
$('errormsg-1-password').hidden = true;
+ $('errormsg-different-email').hidden = true;
$('errormsg-0-connection').hidden = true;
$('errormsg-0-access-code').hidden = true;
$('errormsg-0-otp').hidden = true;
@@ -848,6 +856,8 @@ cr.define('options', function() {
},
setErrorVisibility_: function() {
+ var errormsgDifferentEmail = $('errormsg-different-email');
+ var isErrormsgDifferentEmailHidden = errormsgDifferentEmail.hidden;
this.resetErrorVisibility_();
var f = $('gaia-login-form');
var email = $('gaia-email');
@@ -857,6 +867,14 @@ cr.define('options', function() {
this.setBlurbError_();
return false;
}
+ // If email is different from last email, and we have not already warned
+ // the user, tell them now. Otherwise proceed as usual.
+ if (this.lastEmailAddress_.length > 0 &&
+ email.value != this.lastEmailAddress_ &&
+ isErrormsgDifferentEmailHidden) {
+ errormsgDifferentEmail.hidden = false;
+ return false;
+ }
// Don't enforce password being non-blank when checking access code (it
// will have been cleared when the page was displayed).
if (!this.allowEmptyPassword_ && !passwd.value) {
diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc
index 6215cd8..556d803 100644
--- a/chrome/browser/ui/webui/sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/sync_setup_handler.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
@@ -29,6 +30,7 @@
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
@@ -287,6 +289,7 @@ void SyncSetupHandler::GetStaticLocalizedValues(
{ "emailLabel", IDS_SYNC_LOGIN_EMAIL_NEW_LINE },
{ "passwordLabel", IDS_SYNC_LOGIN_PASSWORD_NEW_LINE },
{ "invalidCredentials", IDS_SYNC_INVALID_USER_CREDENTIALS },
+ { "differentEmail", IDS_SYNC_DIFFERENT_EMAIL },
{ "signin", IDS_SYNC_SIGNIN },
{ "couldNotConnect", IDS_SYNC_LOGIN_COULD_NOT_CONNECT },
{ "unrecoverableError", IDS_SYNC_UNRECOVERABLE_ERROR },
@@ -603,6 +606,12 @@ void SyncSetupHandler::DisplayGaiaLoginWithErrorMessage(
else if (error == GoogleServiceAuthError::CAPTCHA_REQUIRED)
args.SetBoolean("hideEmailAndPassword", false);
+ // Tell the page the previous email address used for sync. If the user
+ // enters a different email address, he will be shown a warning.
+ std::string last_email = GetProfile()->GetPrefs()->GetString(
+ prefs::kGoogleServicesLastUsername);
+ args.SetString("lastEmailAddress", last_email);
+
args.SetBoolean("editableUser", editable_user);
if (!local_error_message.empty())
args.SetString("errorMessage", local_error_message);