OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync/profile_sync_service_factory.h" | 5 #include "chrome/browser/sync/profile_sync_service_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync | 126 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync |
127 // is set up and *not* a browser restart for a manual-start platform (where | 127 // is set up and *not* a browser restart for a manual-start platform (where |
128 // sync has already been set up, and should be able to start without user | 128 // sync has already been set up, and should be able to start without user |
129 // intervention). We can get rid of the browser_default eventually, but | 129 // intervention). We can get rid of the browser_default eventually, but |
130 // need to take care that ProfileSyncService doesn't get tripped up between | 130 // need to take care that ProfileSyncService doesn't get tripped up between |
131 // those two cases. Bug 88109. | 131 // those two cases. Bug 88109. |
132 browser_sync::ProfileSyncServiceStartBehavior behavior = | 132 browser_sync::ProfileSyncServiceStartBehavior behavior = |
133 browser_defaults::kSyncAutoStarts ? browser_sync::AUTO_START | 133 browser_defaults::kSyncAutoStarts ? browser_sync::AUTO_START |
134 : browser_sync::MANUAL_START; | 134 : browser_sync::MANUAL_START; |
135 ProfileSyncService* pss = new ProfileSyncService( | 135 ProfileSyncService* pss = new ProfileSyncService( |
136 new ProfileSyncComponentsFactoryImpl(profile, | 136 scoped_ptr<ProfileSyncComponentsFactory>( |
137 CommandLine::ForCurrentProcess(), | 137 new ProfileSyncComponentsFactoryImpl( |
138 sync_service_url, | 138 profile, |
139 token_service, | 139 CommandLine::ForCurrentProcess(), |
140 url_request_context_getter), | 140 sync_service_url, |
| 141 token_service, |
| 142 url_request_context_getter)), |
141 profile, | 143 profile, |
142 signin_wrapper.Pass(), | 144 signin_wrapper.Pass(), |
143 token_service, | 145 token_service, |
144 behavior); | 146 behavior); |
145 | 147 |
146 pss->factory()->RegisterDataTypes(pss); | 148 pss->factory()->RegisterDataTypes(pss); |
147 pss->Initialize(); | 149 pss->Initialize(); |
148 return pss; | 150 return pss; |
149 } | 151 } |
150 | 152 |
151 // static | 153 // static |
152 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 154 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
153 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; | 155 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; |
154 } | 156 } |
OLD | NEW |