Chromium Code Reviews| 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 142ab3c489967a8aa7ebf42cb62576034ebe1a29..f851b26b1825e6d10faf6671e1a48384d226ef6d 100644 |
| --- a/chrome/browser/ui/webui/options/sync_setup_handler.cc |
| +++ b/chrome/browser/ui/webui/options/sync_setup_handler.cc |
| @@ -42,7 +42,6 @@ |
| #include "components/google/core/browser/google_util.h" |
| #include "components/signin/core/browser/signin_error_controller.h" |
| #include "components/signin/core/browser/signin_header_helper.h" |
| -#include "components/signin/core/browser/signin_metrics.h" |
| #include "components/signin/core/common/profile_management_switches.h" |
| #include "components/sync_driver/sync_prefs.h" |
| #include "content/public/browser/render_view_host.h" |
| @@ -335,16 +334,18 @@ void SyncSetupHandler::RegisterMessages() { |
| } |
| #if !defined(OS_CHROMEOS) |
| -void SyncSetupHandler::DisplayGaiaLogin() { |
| +void SyncSetupHandler::DisplayGaiaLogin( |
| + signin_metrics::AccessPoint access_point) { |
| DCHECK(!sync_startup_tracker_); |
| // Advanced options are no longer being configured if the login screen is |
| // visible. If the user exits the signin wizard after this without |
| // configuring sync, CloseSyncSetup() will ensure they are logged out. |
| configuring_sync_ = false; |
| - DisplayGaiaLoginInNewTabOrWindow(); |
| + DisplayGaiaLoginInNewTabOrWindow(access_point); |
| } |
| -void SyncSetupHandler::DisplayGaiaLoginInNewTabOrWindow() { |
| +void SyncSetupHandler::DisplayGaiaLoginInNewTabOrWindow( |
| + signin_metrics::AccessPoint access_point) { |
| Browser* browser = chrome::FindBrowserWithWebContents( |
| web_ui()->GetWebContents()); |
| bool force_new_tab = false; |
| @@ -371,19 +372,20 @@ void SyncSetupHandler::DisplayGaiaLoginInNewTabOrWindow() { |
| if (!force_new_tab) { |
| browser->window()->ShowAvatarBubbleFromAvatarButton( |
| BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH, |
| - signin::ManageAccountsParams()); |
| + signin::ManageAccountsParams(), access_point); |
| } else { |
| - url = signin::GetReauthURL(browser->profile(), |
| - error_controller->error_account_id()); |
| + url = signin::GetReauthURL( |
| + access_point, signin_metrics::REASON_REAUTHENTICATION, |
| + browser->profile(), error_controller->error_account_id()); |
| } |
| } else { |
| - signin_metrics::LogSigninSource(signin_metrics::SOURCE_SETTINGS); |
| if (!force_new_tab) { |
| browser->window()->ShowAvatarBubbleFromAvatarButton( |
| BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, |
| - signin::ManageAccountsParams()); |
| + signin::ManageAccountsParams(), access_point); |
| } else { |
| - url = signin::GetPromoURL(signin_metrics::SOURCE_SETTINGS, true); |
| + url = signin::GetPromoURL( |
| + access_point, signin_metrics::REASON_SIGNIN_PRIMARY_ACCOUNT, true); |
| } |
| } |
| @@ -628,7 +630,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(); |
| + OpenSyncSetup(args); |
| } |
| #if defined(OS_CHROMEOS) |
| @@ -645,7 +647,7 @@ 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(); |
| + OpenSyncSetup(args); |
| } |
| void SyncSetupHandler::HandleStopSyncing(const base::ListValue* args) { |
| @@ -717,7 +719,7 @@ void SyncSetupHandler::CloseSyncSetup() { |
| configuring_sync_ = false; |
| } |
| -void SyncSetupHandler::OpenSyncSetup() { |
| +void SyncSetupHandler::OpenSyncSetup(const base::ListValue* args) { |
| if (!PrepareSyncSetup()) |
| return; |
| @@ -743,7 +745,14 @@ void SyncSetupHandler::OpenSyncSetup() { |
| // 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(); |
| - DisplayGaiaLogin(); |
| + if (args != NULL) { |
|
Bernhard Bauer
2015/12/04 11:06:24
Just do `if (args)` directly.
gogerald1
2015/12/04 20:49:09
Done.
|
| + std::string access_point = base::UTF16ToUTF8(ExtractStringValue(args)); |
| + if (access_point == "access-point-supervised-user") { |
| + DisplayGaiaLogin(signin_metrics::ACCESS_POINT_SUPERVISED_USER); |
| + return; |
| + } |
| + } |
| + DisplayGaiaLogin(signin_metrics::ACCESS_POINT_SETTINGS); |
| return; |
| } |
| #endif |