summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 05:17:03 +0000
committerrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 05:17:03 +0000
commitb7bb44fe6107abbca930f3db19540d4ce3dbf6dc (patch)
tree45772dc08f404a56d6748a0e72bb176cd62fb736
parent0fa17dab3c9bc209404313e16594f1eb056ef4a7 (diff)
downloadchromium_src-b7bb44fe6107abbca930f3db19540d4ce3dbf6dc.zip
chromium_src-b7bb44fe6107abbca930f3db19540d4ce3dbf6dc.tar.gz
chromium_src-b7bb44fe6107abbca930f3db19540d4ce3dbf6dc.tar.bz2
Put pre- and auto-login behind flags.
Scott: please review the code under UI. Tim: please review the rest. BUG=None TEST=Make sure these feature are not enabled if the about:flags option is not set. Also make sure the option to enable auto-login is not visible in the Passwords section of the Personal Stuff section of the options page. Review URL: http://codereview.chromium.org/7740083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99131 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd11
-rw-r--r--chrome/browser/about_flags.cc7
-rw-r--r--chrome/browser/sync/signin_manager.cc3
-rw-r--r--chrome/browser/ui/autologin_infobar_delegate.cc5
-rw-r--r--chrome/browser/ui/webui/options/personal_options_handler.cc10
-rw-r--r--chrome/common/chrome_switches.cc5
-rw-r--r--chrome/common/chrome_switches.h1
7 files changed, 33 insertions, 9 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 96a167e..a803937 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -4490,13 +4490,14 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_DESCRIPTION" desc="Description for the flag to turn on smooth scrolling">
Enable the experimental smooth scrolling implementation.
</message>
- <message name="IDS_FLAGS_PRE_LOGIN_NAME" desc="Title for the flag to pre-login the user">
- Turn off pre-login
+ <message name="IDS_FLAGS_ENABLE_AUTOLOGIN_NAME" desc="Title for the flag to auto-login the user">
+ Enable pre- and auto-login
</message>
- <message name="IDS_FLAGS_PRE_LOGIN_DESCRIPTION" desc="Description for the flag to pre-login the user">
- When pre-login is turned on, connecting a profile to a Google Account will add the account's cookies
+ <message name="IDS_FLAGS_ENABLE_AUTOLOGIN_DESCRIPTION" desc="Description for the flag to pre-login the user">
+ When enabled, connecting a profile to a Google Account will add the account's credentials
to the profile's cookie jar, so that retyping the username and password in the browser is not necessary.
- Pre-login is always disabled if the profile is not connected to a Google Account.
+ Visiting a Google Account login page will also trigger an infobar allowing easy sign in with the connected account.
+ Pre- and auto-login are always disabled if the profile is not connected to a Google Account, regardless of this flag.
</message>
<message name="IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_NAME" desc="Title for the flag to show Autofill field type predictions for all forms">
Show Autofill predictions
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 7867a8a..af1ed17 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -403,6 +403,13 @@ const Experiment kExperiments[] = {
kOsAll,
SINGLE_VALUE_TYPE(switches::kDownloadsNewUI)
},
+ {
+ "enable-autologin",
+ IDS_FLAGS_ENABLE_AUTOLOGIN_NAME,
+ IDS_FLAGS_ENABLE_AUTOLOGIN_DESCRIPTION,
+ kOsMac | kOsWin | kOsLinux,
+ SINGLE_VALUE_TYPE(switches::kEnableAutologin)
+ },
};
const Experiment* experiments = kExperiments;
diff --git a/chrome/browser/sync/signin_manager.cc b/chrome/browser/sync/signin_manager.cc
index 616a7c0..f299652 100644
--- a/chrome/browser/sync/signin_manager.cc
+++ b/chrome/browser/sync/signin_manager.cc
@@ -136,7 +136,8 @@ void SigninManager::StartSignIn(const std::string& username,
// 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.
#if !defined(OS_CHROMEOS)
- if (profile_->GetPrefs()->GetBoolean(prefs::kAutologinEnabled)) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutologin) &&
+ profile_->GetPrefs()->GetBoolean(prefs::kAutologinEnabled)) {
registrar_.Add(this,
chrome::NOTIFICATION_TOKEN_AVAILABLE,
Source<TokenService>(profile_->GetTokenService()));
diff --git a/chrome/browser/ui/autologin_infobar_delegate.cc b/chrome/browser/ui/autologin_infobar_delegate.cc
index b756933..ddf3c95 100644
--- a/chrome/browser/ui/autologin_infobar_delegate.cc
+++ b/chrome/browser/ui/autologin_infobar_delegate.cc
@@ -138,6 +138,11 @@ void AutoLoginInfoBarDelegate::ShowIfAutoLoginRequested(
net::URLRequest* request,
int child_id,
int route_id) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableAutologin)) {
+ return;
+ }
+
// See if the response contains the X-Auto-Login header. If so, this was
// a request for a login page, and the server is allowing the browser to
// suggest auto-login, if available.
diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc
index 37d84da..e8febe8 100644
--- a/chrome/browser/ui/webui/options/personal_options_handler.cc
+++ b/chrome/browser/ui/webui/options/personal_options_handler.cc
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/callback.h"
+#include "base/command_line.h"
#include "base/path_service.h"
#include "base/stl_util.h"
#include "base/string_number_conversions.h"
@@ -316,9 +317,12 @@ void PersonalOptionsHandler::OnStateChanged() {
web_ui_->CallJavascriptFunction("PersonalOptions.setSyncStatusErrorVisible",
*visible);
- visible.reset(Value::CreateBooleanValue(service->AreCredentialsAvailable()));
- web_ui_->CallJavascriptFunction("PersonalOptions.setAutoLoginVisible",
- *visible);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutologin)) {
+ visible.reset(Value::CreateBooleanValue(
+ service->AreCredentialsAvailable()));
+ web_ui_->CallJavascriptFunction("PersonalOptions.setAutoLoginVisible",
+ *visible);
+ }
// Set profile creation text and button if multi-profiles switch is on.
visible.reset(Value::CreateBooleanValue(multiprofile_));
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 7193cee..a1d8084 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -406,6 +406,11 @@ const char kEnableAuthNegotiatePort[] = "enable-auth-negotiate-port";
// automatically due to privacy concerns.
const char kEnableAutofillFeedback[] = "enable-autofill-feedback";
+// Enables the pre- and auto-login features. When a user signs in to sync,
+// the browser's cookie jar is pre-filled with GAIA cookies. When the user
+// visits a GAIA login page, an info bar can help the user login.
+const char kEnableAutologin[] = "enable-autologin";
+
// This flag enables UI for clearing server data. Temporarily in place
// until there's a server endpoint deployed.
const char kEnableClearServerData[] = "enable-clear-server-data";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 3a9f884..3891c386 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -120,6 +120,7 @@ extern const char kDumpHistogramsOnExit[];
extern const char kEnableAeroPeekTabs[];
extern const char kEnableAuthNegotiatePort[];
extern const char kEnableAutofillFeedback[];
+extern const char kEnableAutologin[];
extern const char kEnableClearServerData[];
extern const char kEnableClickToPlay[];
extern const char kEnableCloudPrintProxy[];