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

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

Issue 2044303004: Sync: Support multiple setup UIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android 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 ProfileSyncServiceFactory::GetForProfile(profile_)->SetSetupInProgress(true); 685 setup_handle_ = ProfileSyncServiceFactory::GetForProfile(profile_)
686 ->GetSetupInProgressHandle();
686 } 687 }
687 688
688 void SupervisedUserService::FinishSetupSyncWhenReady() { 689 void SupervisedUserService::FinishSetupSyncWhenReady() {
689 // If we're already waiting for the Sync backend, there's nothing to do here. 690 // If we're already waiting for the Sync backend, there's nothing to do here.
690 if (waiting_for_sync_initialization_) 691 if (waiting_for_sync_initialization_)
691 return; 692 return;
692 693
693 // Continue in FinishSetupSync() once the Sync backend has been initialized. 694 // Continue in FinishSetupSync() once the Sync backend has been initialized.
694 ProfileSyncService* service = 695 ProfileSyncService* service =
695 ProfileSyncServiceFactory::GetForProfile(profile_); 696 ProfileSyncServiceFactory::GetForProfile(profile_);
696 if (service->IsBackendInitialized()) { 697 if (service->IsBackendInitialized()) {
697 FinishSetupSync(); 698 FinishSetupSync();
698 } else { 699 } else {
699 service->AddObserver(this); 700 service->AddObserver(this);
700 waiting_for_sync_initialization_ = true; 701 waiting_for_sync_initialization_ = true;
701 } 702 }
702 } 703 }
703 704
704 void SupervisedUserService::FinishSetupSync() { 705 void SupervisedUserService::FinishSetupSync() {
705 ProfileSyncService* service = 706 ProfileSyncService* service =
706 ProfileSyncServiceFactory::GetForProfile(profile_); 707 ProfileSyncServiceFactory::GetForProfile(profile_);
707 DCHECK(service->IsBackendInitialized()); 708 DCHECK(service->IsBackendInitialized());
708 709
709 // Sync nothing (except types which are set via GetPreferredDataTypes). 710 // Sync nothing (except types which are set via GetPreferredDataTypes).
710 bool sync_everything = false; 711 bool sync_everything = false;
711 syncer::ModelTypeSet synced_datatypes; 712 syncer::ModelTypeSet synced_datatypes;
712 service->OnUserChoseDatatypes(sync_everything, synced_datatypes); 713 service->OnUserChoseDatatypes(sync_everything, synced_datatypes);
713 714
714 // Notify ProfileSyncService that we are done with configuration. 715 // Notify ProfileSyncService that we are done with configuration.
715 service->SetSetupInProgress(false); 716 setup_handle_.reset();
716 service->SetFirstSetupComplete(); 717 service->SetFirstSetupComplete();
717 } 718 }
718 #endif 719 #endif
719 720
720 bool SupervisedUserService::ProfileIsSupervised() const { 721 bool SupervisedUserService::ProfileIsSupervised() const {
721 return profile_->IsSupervised(); 722 return profile_->IsSupervised();
722 } 723 }
723 724
724 void SupervisedUserService::OnCustodianInfoChanged() { 725 void SupervisedUserService::OnCustodianInfoChanged() {
725 FOR_EACH_OBSERVER( 726 FOR_EACH_OBSERVER(
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); 1058 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile"));
1058 1059
1059 is_profile_active_ = profile_became_active; 1060 is_profile_active_ = profile_became_active;
1060 } 1061 }
1061 #endif // !defined(OS_ANDROID) 1062 #endif // !defined(OS_ANDROID)
1062 1063
1063 void SupervisedUserService::OnSiteListUpdated() { 1064 void SupervisedUserService::OnSiteListUpdated() {
1064 FOR_EACH_OBSERVER( 1065 FOR_EACH_OBSERVER(
1065 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged()); 1066 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged());
1066 } 1067 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698