Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1550)

Unified Diff: chrome/browser/ui/webui/options/sync_setup_handler.cc

Issue 1608103002: Settings Rewrite: Fix Opening Sync User login (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittest Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/sync_setup_handler.cc
diff --git a/chrome/browser/ui/webui/options/sync_setup_handler.cc b/chrome/browser/ui/webui/options/sync_setup_handler.cc
index 639f0688ca017095a31530aed20f34e5044be2fa..a46f45c72aeb6ccd62f5596ad622fd24e37386cb 100644
--- a/chrome/browser/ui/webui/options/sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/options/sync_setup_handler.cc
@@ -649,7 +649,7 @@ void SyncSetupHandler::HandleShowSetupUI(const base::ListValue* args) {
// If a setup wizard is present on this page or another, bring it to focus.
// Otherwise, display a new one on this page.
if (!FocusExistingWizardIfPresent())
- OpenSyncSetup(args);
+ OpenSyncSetup(false /* creating_supervised_user */);
}
#if defined(OS_CHROMEOS)
@@ -664,9 +664,12 @@ void SyncSetupHandler::HandleDoSignOutOnAuthError(const base::ListValue* args) {
#if !defined(OS_CHROMEOS)
void SyncSetupHandler::HandleStartSignin(const base::ListValue* args) {
// Should only be called if the user is not already signed in.
- DCHECK(!SigninManagerFactory::GetForProfile(GetProfile())->
- IsAuthenticated());
- OpenSyncSetup(args);
+ DCHECK(!SigninManagerFactory::GetForProfile(GetProfile())->IsAuthenticated());
+ std::string access_point;
+ bool creating_supervised_user =
+ args->GetString(0, &access_point) &&
+ access_point == "access-point-supervised-user";
Dan Beam 2016/02/03 00:45:35 if we stick with a string, make this a constant an
tommycli 2016/02/03 02:04:21 Done. I just changed it to a bool.
+ OpenSyncSetup(creating_supervised_user);
}
void SyncSetupHandler::HandleStopSyncing(const base::ListValue* args) {
@@ -738,7 +741,7 @@ void SyncSetupHandler::CloseSyncSetup() {
configuring_sync_ = false;
}
-void SyncSetupHandler::OpenSyncSetup(const base::ListValue* args) {
+void SyncSetupHandler::OpenSyncSetup(bool creating_supervised_user) {
if (!PrepareSyncSetup())
return;
@@ -764,15 +767,10 @@ void SyncSetupHandler::OpenSyncSetup(const base::ListValue* args) {
// setup including any visible overlays, and display the gaia auth page.
// Control will be returned to the sync settings page once auth is complete.
CloseUI();
- if (args) {
- std::string access_point = base::UTF16ToUTF8(ExtractStringValue(args));
- if (access_point == "access-point-supervised-user") {
- DisplayGaiaLogin(
- signin_metrics::AccessPoint::ACCESS_POINT_SUPERVISED_USER);
- return;
- }
- }
- DisplayGaiaLogin(signin_metrics::AccessPoint::ACCESS_POINT_SETTINGS);
+ DisplayGaiaLogin(
+ creating_supervised_user
+ ? signin_metrics::AccessPoint::ACCESS_POINT_SUPERVISED_USER
+ : signin_metrics::AccessPoint::ACCESS_POINT_SETTINGS);
Dan Beam 2016/02/03 00:45:35 i think ternaries should be like this: creating
tommycli 2016/02/03 02:04:21 Done.
return;
}
#endif
« no previous file with comments | « chrome/browser/ui/webui/options/sync_setup_handler.h ('k') | chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698