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

Side by Side Diff: chrome/browser/ui/webui/settings/people_handler.cc

Issue 2102803002: Settings People Revamp: Add special Disconnect logic for domain profiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make behavior same as Options Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 #if !defined(OS_CHROMEOS) 505 #if !defined(OS_CHROMEOS)
506 void PeopleHandler::HandleStartSignin(const base::ListValue* args) { 506 void PeopleHandler::HandleStartSignin(const base::ListValue* args) {
507 // Should only be called if the user is not already signed in. 507 // Should only be called if the user is not already signed in.
508 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); 508 DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated());
509 bool creating_supervised_user = false; 509 bool creating_supervised_user = false;
510 args->GetBoolean(0, &creating_supervised_user); 510 args->GetBoolean(0, &creating_supervised_user);
511 OpenSyncSetup(creating_supervised_user); 511 OpenSyncSetup(creating_supervised_user);
512 } 512 }
513 513
514 void PeopleHandler::HandleStopSyncing(const base::ListValue* args) { 514 void PeopleHandler::HandleStopSyncing(const base::ListValue* args) {
515 if (GetSyncService())
516 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
517
518 bool delete_profile = false; 515 bool delete_profile = false;
519 args->GetBoolean(0, &delete_profile); 516 args->GetBoolean(0, &delete_profile);
520 signin_metrics::SignoutDelete delete_metric = 517 bool domain_managed_profile = false;
521 delete_profile ? signin_metrics::SignoutDelete::DELETED 518 args->GetBoolean(0, &domain_managed_profile);
522 : signin_metrics::SignoutDelete::KEEPING; 519
523 SigninManagerFactory::GetForProfile(profile_) 520 if (!domain_managed_profile) {
dpapad 2016/06/28 22:17:22 Same question here. Why are we trusting JS for thi
tommycli 2016/06/28 23:26:00 Done. It was the way before just because I was cop
524 ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, delete_metric); 521 if (GetSyncService())
522 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
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 }
525 530
526 if (delete_profile) { 531 if (delete_profile) {
527 // Do as BrowserOptionsHandler::DeleteProfile().
528 webui::DeleteProfileAtPath(profile_->GetPath(), 532 webui::DeleteProfileAtPath(profile_->GetPath(),
529 web_ui(), 533 web_ui(),
530 ProfileMetrics::DELETE_PROFILE_SETTINGS); 534 ProfileMetrics::DELETE_PROFILE_SETTINGS);
531 } 535 }
532 } 536 }
533 #endif 537 #endif
534 538
535 void PeopleHandler::HandleGetSyncStatus(const base::ListValue* args) { 539 void PeopleHandler::HandleGetSyncStatus(const base::ListValue* args) {
536 AllowJavascript(); 540 AllowJavascript();
537 541
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 base::FilePath profile_file_path = profile_->GetPath(); 894 base::FilePath profile_file_path = profile_->GetPath();
891 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); 895 ProfileMetrics::LogProfileSyncSignIn(profile_file_path);
892 896
893 // 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
894 // start syncing. 898 // start syncing.
895 sync_blocker_.reset(); 899 sync_blocker_.reset();
896 service->SetFirstSetupComplete(); 900 service->SetFirstSetupComplete();
897 } 901 }
898 902
899 } // namespace settings 903 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698