OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/sync/glue/sync_start_util.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "chrome/browser/browser_process.h" | |
9 #include "chrome/browser/profiles/profile.h" | |
10 #include "chrome/browser/profiles/profile_manager.h" | |
11 #include "chrome/browser/sync/profile_sync_service.h" | |
12 #include "chrome/browser/sync/profile_sync_service_factory.h" | |
13 #include "content/public/browser/browser_thread.h" | |
14 | |
15 namespace sync_start_util { | |
16 void StartSyncOnUIThread(const base::FilePath& profile, | |
Nicolas Zea
2013/05/01 22:37:04
have these two methods be within an anon namespace
tim (not reviewing)
2013/05/03 00:20:51
Done.
| |
17 syncer::ModelType type) { | |
18 ProfileManager* profile_manager = g_browser_process->profile_manager(); | |
19 Profile* p = profile_manager->GetProfileByPath(profile); | |
20 if (!p) { | |
21 DVLOG(2) << "Profile not found, can't start sync."; | |
22 return; | |
23 } | |
24 | |
25 ProfileSyncService* service = ProfileSyncServiceFactory::GetForProfile(p); | |
26 if (!service) { | |
27 DVLOG(2) << "No ProfileSyncService for profile, can't start sync."; | |
28 return; | |
29 } | |
30 service->OnDataTypeRequestsSyncStartup(type); | |
31 } | |
32 | |
33 void StartSyncProxy(const base::FilePath& profile, | |
34 syncer::ModelType type) { | |
35 content::BrowserThread::PostTask( | |
36 content::BrowserThread::UI, FROM_HERE, | |
37 base::Bind(&StartSyncOnUIThread, profile, type)); | |
38 } | |
39 | |
40 syncer::StartSyncFlare GetFlareForSyncableService( | |
41 const base::FilePath& profile_path) { | |
42 return base::Bind(&StartSyncProxy, profile_path); | |
43 } | |
44 | |
45 } // namespace sync_start_util | |
OLD | NEW |