| 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 service->SetSetupInProgress(true); | 307 setup_handle_ = service->GetSetupInProgressHandle(); |
| 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 if (sync_service) | 617 setup_handle_.reset(); |
| 618 sync_service->SetSetupInProgress(false); | |
| 619 | 618 |
| 620 configuring_sync_ = false; | 619 configuring_sync_ = false; |
| 621 } | 620 } |
| 622 | 621 |
| 623 void PeopleHandler::OpenSyncSetup(bool creating_supervised_user) { | 622 void PeopleHandler::OpenSyncSetup(bool creating_supervised_user) { |
| 624 if (!PrepareSyncSetup()) | 623 if (!PrepareSyncSetup()) |
| 625 return; | 624 return; |
| 626 | 625 |
| 627 // There are several different UI flows that can bring the user here: | 626 // There are several different UI flows that can bring the user here: |
| 628 // 1) Signin promo. | 627 // 1) Signin promo. |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 DCHECK(service); | 906 DCHECK(service); |
| 908 if (service->IsFirstSetupComplete()) | 907 if (service->IsFirstSetupComplete()) |
| 909 return; | 908 return; |
| 910 | 909 |
| 911 // This is the first time configuring sync, so log it. | 910 // This is the first time configuring sync, so log it. |
| 912 base::FilePath profile_file_path = profile_->GetPath(); | 911 base::FilePath profile_file_path = profile_->GetPath(); |
| 913 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); | 912 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); |
| 914 | 913 |
| 915 // We're done configuring, so notify ProfileSyncService that it is OK to | 914 // We're done configuring, so notify ProfileSyncService that it is OK to |
| 916 // start syncing. | 915 // start syncing. |
| 917 service->SetSetupInProgress(false); | 916 setup_handle_.reset(); |
| 918 service->SetFirstSetupComplete(); | 917 service->SetFirstSetupComplete(); |
| 919 } | 918 } |
| 920 | 919 |
| 921 } // namespace settings | 920 } // namespace settings |
| OLD | NEW |