| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/options/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/options/sync_setup_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 base::Unretained(this))); | 325 base::Unretained(this))); |
| 326 web_ui()->RegisterMessageCallback( | 326 web_ui()->RegisterMessageCallback( |
| 327 "SyncSetupShowSetupUI", | 327 "SyncSetupShowSetupUI", |
| 328 base::Bind(&SyncSetupHandler::HandleShowSetupUI, | 328 base::Bind(&SyncSetupHandler::HandleShowSetupUI, |
| 329 base::Unretained(this))); | 329 base::Unretained(this))); |
| 330 web_ui()->RegisterMessageCallback("CloseTimeout", | 330 web_ui()->RegisterMessageCallback("CloseTimeout", |
| 331 base::Bind(&SyncSetupHandler::HandleCloseTimeout, | 331 base::Bind(&SyncSetupHandler::HandleCloseTimeout, |
| 332 base::Unretained(this))); | 332 base::Unretained(this))); |
| 333 #if defined(OS_CHROMEOS) | 333 #if defined(OS_CHROMEOS) |
| 334 web_ui()->RegisterMessageCallback( | 334 web_ui()->RegisterMessageCallback( |
| 335 "SyncSetupDoSignOutOnAuthError", | 335 "AttemptUserExit", |
| 336 base::Bind(&SyncSetupHandler::HandleDoSignOutOnAuthError, | 336 base::Bind(&SyncSetupHandler::HandleAttemptUserExit, |
| 337 base::Unretained(this))); | 337 base::Unretained(this))); |
| 338 #else | 338 #else |
| 339 web_ui()->RegisterMessageCallback("SyncSetupStopSyncing", | 339 web_ui()->RegisterMessageCallback("SyncSetupStopSyncing", |
| 340 base::Bind(&SyncSetupHandler::HandleStopSyncing, | 340 base::Bind(&SyncSetupHandler::HandleStopSyncing, |
| 341 base::Unretained(this))); | 341 base::Unretained(this))); |
| 342 web_ui()->RegisterMessageCallback("SyncSetupStartSignIn", | 342 web_ui()->RegisterMessageCallback("SyncSetupStartSignIn", |
| 343 base::Bind(&SyncSetupHandler::HandleStartSignin, | 343 base::Bind(&SyncSetupHandler::HandleStartSignin, |
| 344 base::Unretained(this))); | 344 base::Unretained(this))); |
| 345 #endif | 345 #endif |
| 346 } | 346 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 633 |
| 634 // If a setup wizard is present on this page or another, bring it to focus. | 634 // If a setup wizard is present on this page or another, bring it to focus. |
| 635 // Otherwise, display a new one on this page. | 635 // Otherwise, display a new one on this page. |
| 636 if (!FocusExistingWizardIfPresent()) | 636 if (!FocusExistingWizardIfPresent()) |
| 637 OpenSyncSetup(false /* creating_supervised_user */); | 637 OpenSyncSetup(false /* creating_supervised_user */); |
| 638 } | 638 } |
| 639 | 639 |
| 640 #if defined(OS_CHROMEOS) | 640 #if defined(OS_CHROMEOS) |
| 641 // On ChromeOS, we need to sign out the user session to fix an auth error, so | 641 // On ChromeOS, we need to sign out the user session to fix an auth error, so |
| 642 // the user goes through the real signin flow to generate a new auth token. | 642 // the user goes through the real signin flow to generate a new auth token. |
| 643 void SyncSetupHandler::HandleDoSignOutOnAuthError(const base::ListValue* args) { | 643 void SyncSetupHandler::HandleAttemptUserExit(const base::ListValue* args) { |
| 644 DVLOG(1) << "Signing out the user to fix a sync error."; | |
| 645 chrome::AttemptUserExit(); | 644 chrome::AttemptUserExit(); |
| 646 } | 645 } |
| 647 #endif | 646 #endif |
| 648 | 647 |
| 649 #if !defined(OS_CHROMEOS) | 648 #if !defined(OS_CHROMEOS) |
| 650 void SyncSetupHandler::HandleStartSignin(const base::ListValue* args) { | 649 void SyncSetupHandler::HandleStartSignin(const base::ListValue* args) { |
| 651 // Should only be called if the user is not already signed in. | 650 // Should only be called if the user is not already signed in. |
| 652 DCHECK(!SigninManagerFactory::GetForProfile(GetProfile())->IsAuthenticated()); | 651 DCHECK(!SigninManagerFactory::GetForProfile(GetProfile())->IsAuthenticated()); |
| 653 bool creating_supervised_user = false; | 652 bool creating_supervised_user = false; |
| 654 args->GetBoolean(0, &creating_supervised_user); | 653 args->GetBoolean(0, &creating_supervised_user); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 page, args); | 944 page, args); |
| 946 | 945 |
| 947 // Make sure the tab used for the Gaia sign in does not cover the settings | 946 // Make sure the tab used for the Gaia sign in does not cover the settings |
| 948 // tab. | 947 // tab. |
| 949 FocusUI(); | 948 FocusUI(); |
| 950 } | 949 } |
| 951 | 950 |
| 952 LoginUIService* SyncSetupHandler::GetLoginUIService() const { | 951 LoginUIService* SyncSetupHandler::GetLoginUIService() const { |
| 953 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 952 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
| 954 } | 953 } |
| OLD | NEW |