| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync | 141 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync |
| 142 // is set up and *not* a browser restart for a manual-start platform (where | 142 // is set up and *not* a browser restart for a manual-start platform (where |
| 143 // sync has already been set up, and should be able to start without user | 143 // sync has already been set up, and should be able to start without user |
| 144 // intervention). We can get rid of the browser_default eventually, but | 144 // intervention). We can get rid of the browser_default eventually, but |
| 145 // need to take care that ProfileSyncService doesn't get tripped up between | 145 // need to take care that ProfileSyncService doesn't get tripped up between |
| 146 // those two cases. Bug 88109. | 146 // those two cases. Bug 88109. |
| 147 browser_sync::ProfileSyncServiceStartBehavior behavior = | 147 browser_sync::ProfileSyncServiceStartBehavior behavior = |
| 148 browser_defaults::kSyncAutoStarts ? browser_sync::AUTO_START | 148 browser_defaults::kSyncAutoStarts ? browser_sync::AUTO_START |
| 149 : browser_sync::MANUAL_START; | 149 : browser_sync::MANUAL_START; |
| 150 ProfileSyncService* pss = new ProfileSyncService( | 150 ProfileSyncService* pss = new ProfileSyncService( |
| 151 scoped_ptr<ProfileSyncComponentsFactory>( | 151 scoped_ptr<sync_driver::SyncApiComponentFactory>( |
| 152 new ProfileSyncComponentsFactoryImpl( | 152 new ProfileSyncComponentsFactoryImpl( |
| 153 profile, base::CommandLine::ForCurrentProcess(), sync_service_url, | 153 profile, base::CommandLine::ForCurrentProcess(), sync_service_url, |
| 154 token_service, url_request_context_getter)), | 154 token_service, url_request_context_getter)), |
| 155 profile, signin_wrapper.Pass(), token_service, behavior); | 155 profile, signin_wrapper.Pass(), token_service, behavior); |
| 156 | 156 pss->factory()->Initialize(pss); |
| 157 pss->factory()->RegisterDataTypes(pss); | 157 pss->factory()->RegisterDataTypes(pss); |
| 158 pss->Initialize(); | 158 pss->Initialize(); |
| 159 return pss; | 159 return pss; |
| 160 } | 160 } |
| 161 | 161 |
| 162 // static | 162 // static |
| 163 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 163 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
| 164 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; | 164 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; |
| 165 } | 165 } |
| OLD | NEW |