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

Side by Side Diff: components/sync_driver/sync_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 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 "components/sync_driver/sync_service.h" 5 #include "components/sync_driver/sync_service.h"
6 6
7 #include "google_apis/gaia/google_service_auth_error.h" 7 #include "google_apis/gaia/google_service_auth_error.h"
8 #include "sync/internal_api/public/sync_manager.h" 8 #include "sync/internal_api/public/sync_manager.h"
9 9
10 namespace sync_driver { 10 namespace sync_driver {
11 11
12 SyncSetupInProgressHandle::SyncSetupInProgressHandle(base::Closure on_destroy)
13 : on_destroy_(on_destroy) {}
14
15 SyncSetupInProgressHandle::~SyncSetupInProgressHandle() {
16 on_destroy_.Run();
17 }
18
12 SyncService::SyncTokenStatus::SyncTokenStatus() 19 SyncService::SyncTokenStatus::SyncTokenStatus()
13 : connection_status(syncer::CONNECTION_NOT_ATTEMPTED), 20 : connection_status(syncer::CONNECTION_NOT_ATTEMPTED),
14 last_get_token_error(GoogleServiceAuthError::AuthErrorNone()) {} 21 last_get_token_error(GoogleServiceAuthError::AuthErrorNone()) {}
15 SyncService::SyncTokenStatus::~SyncTokenStatus() {}
16 22
23 std::unique_ptr<SyncSetupInProgressHandle>
24 SyncService::GetSetupInProgressHandle() {
25 if (++outstanding_setup_in_progress_handles_ == 1)
26 SetSetupInProgress(true);
27
28 return std::unique_ptr<SyncSetupInProgressHandle>(
29 new SyncSetupInProgressHandle(
30 base::Bind(&SyncService::OnSetupInProgressHandleDestroyed,
31 base::Unretained(this))));
17 } 32 }
33
34 void SyncService::OnSetupInProgressHandleDestroyed() {
35 if (--outstanding_setup_in_progress_handles_ == 0)
36 SetSetupInProgress(false);
37 }
38
39 } // namespace sync_driver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698