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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service.cc

Issue 2066493003: Revert of Sync: Support multiple setup UIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/supervised_user/supervised_user_service.h" 5 #include "chrome/browser/supervised_user/supervised_user_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 callback.Run(auth_error); 675 callback.Run(auth_error);
676 } 676 }
677 void SupervisedUserService::SetupSync() { 677 void SupervisedUserService::SetupSync() {
678 StartSetupSync(); 678 StartSetupSync();
679 FinishSetupSyncWhenReady(); 679 FinishSetupSyncWhenReady();
680 } 680 }
681 681
682 void SupervisedUserService::StartSetupSync() { 682 void SupervisedUserService::StartSetupSync() {
683 // Tell the sync service that setup is in progress so we don't start syncing 683 // Tell the sync service that setup is in progress so we don't start syncing
684 // until we've finished configuration. 684 // until we've finished configuration.
685 sync_blocker_ = ProfileSyncServiceFactory::GetForProfile(profile_) 685 ProfileSyncServiceFactory::GetForProfile(profile_)->SetSetupInProgress(true);
686 ->GetSetupInProgressHandle();
687 } 686 }
688 687
689 void SupervisedUserService::FinishSetupSyncWhenReady() { 688 void SupervisedUserService::FinishSetupSyncWhenReady() {
690 // If we're already waiting for the Sync backend, there's nothing to do here. 689 // If we're already waiting for the Sync backend, there's nothing to do here.
691 if (waiting_for_sync_initialization_) 690 if (waiting_for_sync_initialization_)
692 return; 691 return;
693 692
694 // Continue in FinishSetupSync() once the Sync backend has been initialized. 693 // Continue in FinishSetupSync() once the Sync backend has been initialized.
695 ProfileSyncService* service = 694 ProfileSyncService* service =
696 ProfileSyncServiceFactory::GetForProfile(profile_); 695 ProfileSyncServiceFactory::GetForProfile(profile_);
697 if (service->IsBackendInitialized()) { 696 if (service->IsBackendInitialized()) {
698 FinishSetupSync(); 697 FinishSetupSync();
699 } else { 698 } else {
700 service->AddObserver(this); 699 service->AddObserver(this);
701 waiting_for_sync_initialization_ = true; 700 waiting_for_sync_initialization_ = true;
702 } 701 }
703 } 702 }
704 703
705 void SupervisedUserService::FinishSetupSync() { 704 void SupervisedUserService::FinishSetupSync() {
706 ProfileSyncService* service = 705 ProfileSyncService* service =
707 ProfileSyncServiceFactory::GetForProfile(profile_); 706 ProfileSyncServiceFactory::GetForProfile(profile_);
708 DCHECK(service->IsBackendInitialized()); 707 DCHECK(service->IsBackendInitialized());
709 708
710 // Sync nothing (except types which are set via GetPreferredDataTypes). 709 // Sync nothing (except types which are set via GetPreferredDataTypes).
711 bool sync_everything = false; 710 bool sync_everything = false;
712 syncer::ModelTypeSet synced_datatypes; 711 syncer::ModelTypeSet synced_datatypes;
713 service->OnUserChoseDatatypes(sync_everything, synced_datatypes); 712 service->OnUserChoseDatatypes(sync_everything, synced_datatypes);
714 713
715 // Notify ProfileSyncService that we are done with configuration. 714 // Notify ProfileSyncService that we are done with configuration.
716 sync_blocker_.reset(); 715 service->SetSetupInProgress(false);
717 service->SetFirstSetupComplete(); 716 service->SetFirstSetupComplete();
718 } 717 }
719 #endif 718 #endif
720 719
721 bool SupervisedUserService::ProfileIsSupervised() const { 720 bool SupervisedUserService::ProfileIsSupervised() const {
722 return profile_->IsSupervised(); 721 return profile_->IsSupervised();
723 } 722 }
724 723
725 void SupervisedUserService::OnCustodianInfoChanged() { 724 void SupervisedUserService::OnCustodianInfoChanged() {
726 FOR_EACH_OBSERVER( 725 FOR_EACH_OBSERVER(
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); 1057 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile"));
1059 1058
1060 is_profile_active_ = profile_became_active; 1059 is_profile_active_ = profile_became_active;
1061 } 1060 }
1062 #endif // !defined(OS_ANDROID) 1061 #endif // !defined(OS_ANDROID)
1063 1062
1064 void SupervisedUserService::OnSiteListUpdated() { 1063 void SupervisedUserService::OnSiteListUpdated() {
1065 FOR_EACH_OBSERVER( 1064 FOR_EACH_OBSERVER(
1066 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged()); 1065 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged());
1067 } 1066 }
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_service.h ('k') | chrome/browser/sync/profile_sync_service_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698