Commit cde8e93c authored by rogerta@chromium.org's avatar rogerta@chromium.org

Pre-login should not set cookies and log the user in of cookies are not

enabled for google accounts.

BUG=None
TEST=Create a new profile.  Go to content settings and block all sites from
setting data.  Alternatively, block only the https://accounts.google.com from
setting data.  Now connect the profile a google account.  The browser should
not be logged (i.e. going to gmail should not show the inbox).  Looking at
all cookie and site data should show no cookies for accounts.google.com.

Review URL: http://codereview.chromium.org/9549026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124527 0039d316-1c4b-4281-b951-d872f2087c98
parent 6c25bc10
......@@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "chrome/browser/content_settings/cookie_settings.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/token_service.h"
......@@ -24,6 +25,8 @@ const char kGetInfoEmailKey[] = "email";
const char kGetInfoServicesKey[] = "allServices";
const char kGooglePlusServiceKey[] = "googleme";
const char kGoogleAccountsUrl[] = "https://accounts.google.com";
SigninManager::SigninManager()
: profile_(NULL),
had_two_factor_error_(false),
......@@ -118,11 +121,18 @@ void SigninManager::StartSignIn(const std::string& username,
// Register for token availability. The signin manager will pre-login the
// user when the GAIA service token is ready for use. Only do this if we
// are not running in ChomiumOS, since it handles pre-login itself.
// are not running in ChomiumOS, since it handles pre-login itself, and if
// cookies are not disabled for Google accounts.
#if !defined(OS_CHROMEOS)
registrar_.Add(this,
chrome::NOTIFICATION_TOKEN_AVAILABLE,
content::Source<TokenService>(profile_->GetTokenService()));
CookieSettings* cookie_settings =
CookieSettings::Factory::GetForProfile(profile_);
if (cookie_settings &&
cookie_settings->IsSettingCookieAllowed(GURL(kGoogleAccountsUrl),
GURL(kGoogleAccountsUrl))) {
registrar_.Add(this,
chrome::NOTIFICATION_TOKEN_AVAILABLE,
content::Source<TokenService>(profile_->GetTokenService()));
}
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment