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_components_factory_impl.h" | 5 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 else | 110 else |
111 disabled_types_str += ", " + disable_types_finch; | 111 disabled_types_str += ", " + disable_types_finch; |
112 } | 112 } |
113 | 113 |
114 disabled_types = syncer::ModelTypeSetFromString(disabled_types_str); | 114 disabled_types = syncer::ModelTypeSetFromString(disabled_types_str); |
115 return disabled_types; | 115 return disabled_types; |
116 } | 116 } |
117 | 117 |
118 syncer::ModelTypeSet GetEnabledTypesFromCommandLine( | 118 syncer::ModelTypeSet GetEnabledTypesFromCommandLine( |
119 const base::CommandLine& command_line) { | 119 const base::CommandLine& command_line) { |
120 return syncer::ModelTypeSet(); | 120 syncer::ModelTypeSet enabled_types; |
| 121 if (command_line.HasSwitch(autofill::switches::kEnableWalletMetadataSync)) |
| 122 enabled_types.Put(syncer::AUTOFILL_WALLET_METADATA); |
| 123 |
| 124 return enabled_types; |
121 } | 125 } |
122 | 126 |
123 } // namespace | 127 } // namespace |
124 | 128 |
125 ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl( | 129 ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl( |
126 Profile* profile, | 130 Profile* profile, |
127 base::CommandLine* command_line, | 131 base::CommandLine* command_line, |
128 const GURL& sync_service_url, | 132 const GURL& sync_service_url, |
129 OAuth2TokenService* token_service, | 133 OAuth2TokenService* token_service, |
130 net::URLRequestContextGetter* url_request_context_getter) | 134 net::URLRequestContextGetter* url_request_context_getter) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // enforced by the datatype controller. Register unless explicitly disabled. | 188 // enforced by the datatype controller. Register unless explicitly disabled. |
185 bool wallet_disabled = disabled_types.Has(syncer::AUTOFILL_WALLET_DATA); | 189 bool wallet_disabled = disabled_types.Has(syncer::AUTOFILL_WALLET_DATA); |
186 if (!wallet_disabled) { | 190 if (!wallet_disabled) { |
187 sync_service->RegisterDataTypeController( | 191 sync_service->RegisterDataTypeController( |
188 new browser_sync::AutofillWalletDataTypeController( | 192 new browser_sync::AutofillWalletDataTypeController( |
189 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 193 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
190 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), | 194 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), |
191 error_callback, sync_client, syncer::AUTOFILL_WALLET_DATA)); | 195 error_callback, sync_client, syncer::AUTOFILL_WALLET_DATA)); |
192 } | 196 } |
193 | 197 |
194 // Wallet metadata sync depends on Wallet data sync. Register if Wallet data | 198 // Wallet metadata sync depends on Wallet data sync and is disabled by |
195 // is syncing and metadata sync is not explicitly disabled. | 199 // default. Register if Wallet data is syncing and metadata sync is explicitly |
196 if (!wallet_disabled && | 200 // enabled. |
197 !disabled_types.Has(syncer::AUTOFILL_WALLET_METADATA)) { | 201 if (!wallet_disabled && enabled_types.Has(syncer::AUTOFILL_WALLET_METADATA)) { |
198 sync_service->RegisterDataTypeController( | 202 sync_service->RegisterDataTypeController( |
199 new browser_sync::AutofillWalletDataTypeController( | 203 new browser_sync::AutofillWalletDataTypeController( |
200 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 204 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
201 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), | 205 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), |
202 error_callback, sync_client, syncer::AUTOFILL_WALLET_METADATA)); | 206 error_callback, sync_client, syncer::AUTOFILL_WALLET_METADATA)); |
203 } | 207 } |
204 | 208 |
205 // Bookmark sync is enabled by default. Register unless explicitly | 209 // Bookmark sync is enabled by default. Register unless explicitly |
206 // disabled. | 210 // disabled. |
207 if (!disabled_types.Has(syncer::BOOKMARKS)) { | 211 if (!disabled_types.Has(syncer::BOOKMARKS)) { |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 new TypedUrlModelAssociator(sync_service, | 551 new TypedUrlModelAssociator(sync_service, |
548 history_backend, | 552 history_backend, |
549 error_handler); | 553 error_handler); |
550 TypedUrlChangeProcessor* change_processor = | 554 TypedUrlChangeProcessor* change_processor = |
551 new TypedUrlChangeProcessor(profile_, | 555 new TypedUrlChangeProcessor(profile_, |
552 model_associator, | 556 model_associator, |
553 history_backend, | 557 history_backend, |
554 error_handler); | 558 error_handler); |
555 return SyncComponents(model_associator, change_processor); | 559 return SyncComponents(model_associator, change_processor); |
556 } | 560 } |
OLD | NEW |