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

Side by Side Diff: chrome/browser/sync/glue/sync_start_util.cc

Issue 14018026: sync: SyncableService support for starting sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
(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,
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698