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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync | 122 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync |
123 // is set up and *not* a browser restart for a manual-start platform (where | 123 // is set up and *not* a browser restart for a manual-start platform (where |
124 // sync has already been set up, and should be able to start without user | 124 // sync has already been set up, and should be able to start without user |
125 // intervention). We can get rid of the browser_default eventually, but | 125 // intervention). We can get rid of the browser_default eventually, but |
126 // need to take care that ProfileSyncService doesn't get tripped up between | 126 // need to take care that ProfileSyncService doesn't get tripped up between |
127 // those two cases. Bug 88109. | 127 // those two cases. Bug 88109. |
128 browser_sync::ProfileSyncServiceStartBehavior behavior = | 128 browser_sync::ProfileSyncServiceStartBehavior behavior = |
129 browser_defaults::kSyncAutoStarts ? browser_sync::AUTO_START | 129 browser_defaults::kSyncAutoStarts ? browser_sync::AUTO_START |
130 : browser_sync::MANUAL_START; | 130 : browser_sync::MANUAL_START; |
131 ProfileSyncService* pss = new ProfileSyncService( | 131 ProfileSyncService* pss = new ProfileSyncService( |
132 new ProfileSyncComponentsFactoryImpl(profile, | 132 scoped_ptr<ProfileSyncComponentsFactory>( |
133 CommandLine::ForCurrentProcess(), | 133 new ProfileSyncComponentsFactoryImpl( |
134 sync_service_url, | 134 profile, |
135 token_service, | 135 CommandLine::ForCurrentProcess(), |
136 url_request_context_getter), | 136 sync_service_url, |
| 137 token_service, |
| 138 url_request_context_getter)), |
137 profile, | 139 profile, |
138 signin_wrapper.Pass(), | 140 signin_wrapper.Pass(), |
139 token_service, | 141 token_service, |
140 behavior); | 142 behavior); |
141 | 143 |
142 pss->factory()->RegisterDataTypes(pss); | 144 pss->factory()->RegisterDataTypes(pss); |
143 pss->Initialize(); | 145 pss->Initialize(); |
144 return pss; | 146 return pss; |
145 } | 147 } |
146 | 148 |
147 // static | 149 // static |
148 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 150 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
149 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; | 151 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; |
150 } | 152 } |
OLD | NEW |