| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/settings/people_handler.h" | 5 #include "chrome/browser/ui/webui/settings/people_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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 AllowJavascript(); | 507 AllowJavascript(); |
| 508 | 508 |
| 509 // Should only be called if the user is not already signed in. | 509 // Should only be called if the user is not already signed in. |
| 510 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); | 510 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); |
| 511 bool creating_supervised_user = false; | 511 bool creating_supervised_user = false; |
| 512 args->GetBoolean(0, &creating_supervised_user); | 512 args->GetBoolean(0, &creating_supervised_user); |
| 513 OpenSyncSetup(creating_supervised_user); | 513 OpenSyncSetup(creating_supervised_user); |
| 514 } | 514 } |
| 515 | 515 |
| 516 void PeopleHandler::HandleStopSyncing(const base::ListValue* args) { | 516 void PeopleHandler::HandleStopSyncing(const base::ListValue* args) { |
| 517 if (GetSyncService()) | |
| 518 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); | |
| 519 | |
| 520 bool delete_profile = false; | 517 bool delete_profile = false; |
| 521 args->GetBoolean(0, &delete_profile); | 518 args->GetBoolean(0, &delete_profile); |
| 522 signin_metrics::SignoutDelete delete_metric = | 519 |
| 523 delete_profile ? signin_metrics::SignoutDelete::DELETED | 520 if (!SigninManagerFactory::GetForProfile(profile_)->IsSignoutProhibited()) { |
| 524 : signin_metrics::SignoutDelete::KEEPING; | 521 if (GetSyncService()) |
| 525 SigninManagerFactory::GetForProfile(profile_) | 522 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); |
| 526 ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, delete_metric); | 523 |
| 524 signin_metrics::SignoutDelete delete_metric = |
| 525 delete_profile ? signin_metrics::SignoutDelete::DELETED |
| 526 : signin_metrics::SignoutDelete::KEEPING; |
| 527 SigninManagerFactory::GetForProfile(profile_) |
| 528 ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, delete_metric); |
| 529 } |
| 527 | 530 |
| 528 if (delete_profile) { | 531 if (delete_profile) { |
| 529 // Do as BrowserOptionsHandler::DeleteProfile(). | |
| 530 webui::DeleteProfileAtPath(profile_->GetPath(), | 532 webui::DeleteProfileAtPath(profile_->GetPath(), |
| 531 web_ui(), | 533 web_ui(), |
| 532 ProfileMetrics::DELETE_PROFILE_SETTINGS); | 534 ProfileMetrics::DELETE_PROFILE_SETTINGS); |
| 533 } | 535 } |
| 534 } | 536 } |
| 535 #endif | 537 #endif |
| 536 | 538 |
| 537 void PeopleHandler::HandleGetSyncStatus(const base::ListValue* args) { | 539 void PeopleHandler::HandleGetSyncStatus(const base::ListValue* args) { |
| 538 AllowJavascript(); | 540 AllowJavascript(); |
| 539 | 541 |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 base::FilePath profile_file_path = profile_->GetPath(); | 894 base::FilePath profile_file_path = profile_->GetPath(); |
| 893 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); | 895 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); |
| 894 | 896 |
| 895 // We're done configuring, so notify ProfileSyncService that it is OK to | 897 // We're done configuring, so notify ProfileSyncService that it is OK to |
| 896 // start syncing. | 898 // start syncing. |
| 897 sync_blocker_.reset(); | 899 sync_blocker_.reset(); |
| 898 service->SetFirstSetupComplete(); | 900 service->SetFirstSetupComplete(); |
| 899 } | 901 } |
| 900 | 902 |
| 901 } // namespace settings | 903 } // namespace settings |
| OLD | NEW |