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

Side by Side Diff: chrome/browser/sync/profile_sync_components_factory_impl.cc

Issue 1453633002: Reland of land: Enable Wallet metadata sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 syncer::ModelTypeSet enabled_types; 120 return syncer::ModelTypeSet();
121 if (command_line.HasSwitch(autofill::switches::kEnableWalletMetadataSync))
122 enabled_types.Put(syncer::AUTOFILL_WALLET_METADATA);
123
124 return enabled_types;
125 } 121 }
126 122
127 } // namespace 123 } // namespace
128 124
129 ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl( 125 ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl(
130 Profile* profile, 126 Profile* profile,
131 base::CommandLine* command_line, 127 base::CommandLine* command_line,
132 const GURL& sync_service_url, 128 const GURL& sync_service_url,
133 OAuth2TokenService* token_service, 129 OAuth2TokenService* token_service,
134 net::URLRequestContextGetter* url_request_context_getter) 130 net::URLRequestContextGetter* url_request_context_getter)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // enforced by the datatype controller. Register unless explicitly disabled. 184 // enforced by the datatype controller. Register unless explicitly disabled.
189 bool wallet_disabled = disabled_types.Has(syncer::AUTOFILL_WALLET_DATA); 185 bool wallet_disabled = disabled_types.Has(syncer::AUTOFILL_WALLET_DATA);
190 if (!wallet_disabled) { 186 if (!wallet_disabled) {
191 sync_service->RegisterDataTypeController( 187 sync_service->RegisterDataTypeController(
192 new browser_sync::AutofillWalletDataTypeController( 188 new browser_sync::AutofillWalletDataTypeController(
193 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 189 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
194 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 190 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
195 error_callback, sync_client, syncer::AUTOFILL_WALLET_DATA)); 191 error_callback, sync_client, syncer::AUTOFILL_WALLET_DATA));
196 } 192 }
197 193
198 // Wallet metadata sync depends on Wallet data sync and is disabled by 194 // Wallet metadata sync depends on Wallet data sync. Register if Wallet data
199 // default. Register if Wallet data is syncing and metadata sync is explicitly 195 // is syncing and metadata sync is not explicitly disabled.
200 // enabled. 196 if (!wallet_disabled &&
201 if (!wallet_disabled && enabled_types.Has(syncer::AUTOFILL_WALLET_METADATA)) { 197 !disabled_types.Has(syncer::AUTOFILL_WALLET_METADATA)) {
202 sync_service->RegisterDataTypeController( 198 sync_service->RegisterDataTypeController(
203 new browser_sync::AutofillWalletDataTypeController( 199 new browser_sync::AutofillWalletDataTypeController(
204 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 200 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
205 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 201 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
206 error_callback, sync_client, syncer::AUTOFILL_WALLET_METADATA)); 202 error_callback, sync_client, syncer::AUTOFILL_WALLET_METADATA));
207 } 203 }
208 204
209 // Bookmark sync is enabled by default. Register unless explicitly 205 // Bookmark sync is enabled by default. Register unless explicitly
210 // disabled. 206 // disabled.
211 if (!disabled_types.Has(syncer::BOOKMARKS)) { 207 if (!disabled_types.Has(syncer::BOOKMARKS)) {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 new TypedUrlModelAssociator(sync_service, 547 new TypedUrlModelAssociator(sync_service,
552 history_backend, 548 history_backend,
553 error_handler); 549 error_handler);
554 TypedUrlChangeProcessor* change_processor = 550 TypedUrlChangeProcessor* change_processor =
555 new TypedUrlChangeProcessor(profile_, 551 new TypedUrlChangeProcessor(profile_,
556 model_associator, 552 model_associator,
557 history_backend, 553 history_backend,
558 error_handler); 554 error_handler);
559 return SyncComponents(model_associator, change_processor); 555 return SyncComponents(model_associator, change_processor);
560 } 556 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698