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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 if (!IsActiveLogin()) | 297 if (!IsActiveLogin()) |
298 CloseSyncSetup(); | 298 CloseSyncSetup(); |
299 return false; | 299 return false; |
300 } | 300 } |
301 | 301 |
302 // Notify services that login UI is now active. | 302 // Notify services that login UI is now active. |
303 GetLoginUIService()->SetLoginUI(this); | 303 GetLoginUIService()->SetLoginUI(this); |
304 | 304 |
305 ProfileSyncService* service = GetSyncService(); | 305 ProfileSyncService* service = GetSyncService(); |
306 if (service) | 306 if (service) |
307 sync_blocker_ = service->GetSetupInProgressHandle(); | 307 service->SetSetupInProgress(true); |
308 | 308 |
309 return true; | 309 return true; |
310 } | 310 } |
311 | 311 |
312 void PeopleHandler::DisplaySpinner() { | 312 void PeopleHandler::DisplaySpinner() { |
313 configuring_sync_ = true; | 313 configuring_sync_ = true; |
314 | 314 |
315 const int kTimeoutSec = 30; | 315 const int kTimeoutSec = 30; |
316 DCHECK(!backend_start_timer_); | 316 DCHECK(!backend_start_timer_); |
317 backend_start_timer_.reset(new base::OneShotTimer()); | 317 backend_start_timer_.reset(new base::OneShotTimer()); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 } | 607 } |
608 } | 608 } |
609 } | 609 } |
610 | 610 |
611 GetLoginUIService()->LoginUIClosed(this); | 611 GetLoginUIService()->LoginUIClosed(this); |
612 } | 612 } |
613 | 613 |
614 // Alert the sync service anytime the sync setup dialog is closed. This can | 614 // Alert the sync service anytime the sync setup dialog is closed. This can |
615 // happen due to the user clicking the OK or Cancel button, or due to the | 615 // happen due to the user clicking the OK or Cancel button, or due to the |
616 // dialog being closed by virtue of sync being disabled in the background. | 616 // dialog being closed by virtue of sync being disabled in the background. |
617 sync_blocker_.reset(); | 617 if (sync_service) |
| 618 sync_service->SetSetupInProgress(false); |
618 | 619 |
619 configuring_sync_ = false; | 620 configuring_sync_ = false; |
620 } | 621 } |
621 | 622 |
622 void PeopleHandler::OpenSyncSetup(bool creating_supervised_user) { | 623 void PeopleHandler::OpenSyncSetup(bool creating_supervised_user) { |
623 if (!PrepareSyncSetup()) | 624 if (!PrepareSyncSetup()) |
624 return; | 625 return; |
625 | 626 |
626 // There are several different UI flows that can bring the user here: | 627 // There are several different UI flows that can bring the user here: |
627 // 1) Signin promo. | 628 // 1) Signin promo. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 DCHECK(service); | 907 DCHECK(service); |
907 if (service->IsFirstSetupComplete()) | 908 if (service->IsFirstSetupComplete()) |
908 return; | 909 return; |
909 | 910 |
910 // This is the first time configuring sync, so log it. | 911 // This is the first time configuring sync, so log it. |
911 base::FilePath profile_file_path = profile_->GetPath(); | 912 base::FilePath profile_file_path = profile_->GetPath(); |
912 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); | 913 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); |
913 | 914 |
914 // We're done configuring, so notify ProfileSyncService that it is OK to | 915 // We're done configuring, so notify ProfileSyncService that it is OK to |
915 // start syncing. | 916 // start syncing. |
916 sync_blocker_.reset(); | 917 service->SetSetupInProgress(false); |
917 service->SetFirstSetupComplete(); | 918 service->SetFirstSetupComplete(); |
918 } | 919 } |
919 | 920 |
920 } // namespace settings | 921 } // namespace settings |
OLD | NEW |