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

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

Issue 10829019: [sync] Refactor how default sync datatypes are set. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move pref registration Created 8 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/profile_sync_components_factory_impl.h ('k') | no next file » | 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
8 #include "chrome/browser/extensions/app_notification_manager.h" 8 #include "chrome/browser/extensions/app_notification_manager.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_system.h" 10 #include "chrome/browser/extensions/extension_system.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 extensions::ExtensionSystemFactory::GetForProfile(profile)), 92 extensions::ExtensionSystemFactory::GetForProfile(profile)),
93 web_data_service_(WebDataServiceFactory::GetForProfile( 93 web_data_service_(WebDataServiceFactory::GetForProfile(
94 profile_, Profile::IMPLICIT_ACCESS)) { 94 profile_, Profile::IMPLICIT_ACCESS)) {
95 } 95 }
96 96
97 ProfileSyncComponentsFactoryImpl::~ProfileSyncComponentsFactoryImpl() { 97 ProfileSyncComponentsFactoryImpl::~ProfileSyncComponentsFactoryImpl() {
98 } 98 }
99 99
100 void ProfileSyncComponentsFactoryImpl::RegisterDataTypes( 100 void ProfileSyncComponentsFactoryImpl::RegisterDataTypes(
101 ProfileSyncService* pss) { 101 ProfileSyncService* pss) {
102 RegisterCommonDataTypes(pss);
103 #if !defined(OS_ANDROID)
104 RegisterDesktopDataTypes(pss);
105 #endif
106 }
107
108 void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes(
109 ProfileSyncService* pss) {
110 // Bookmark sync is enabled by default. Register unless explicitly
111 // disabled.
112 if (!command_line_->HasSwitch(switches::kDisableSyncBookmarks)) {
113 pss->RegisterDataTypeController(
114 new BookmarkDataTypeController(this, profile_, pss));
115 }
116
117 // TypedUrl sync is enabled by default. Register unless explicitly disabled,
118 // or if saving history is disabled.
119 if (!profile_->GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled) &&
120 !command_line_->HasSwitch(switches::kDisableSyncTypedUrls)) {
121 pss->RegisterDataTypeController(
122 new TypedUrlDataTypeController(this, profile_, pss));
123 }
124
125 // Session sync is enabled by default. Register unless explicitly disabled.
126 if (!command_line_->HasSwitch(switches::kDisableSyncTabs)) {
127 pss->RegisterDataTypeController(
128 new SessionDataTypeController(this, profile_, pss));
129 }
130 }
131
132 void ProfileSyncComponentsFactoryImpl::RegisterDesktopDataTypes(
133 ProfileSyncService* pss) {
102 // App sync is enabled by default. Register unless explicitly 134 // App sync is enabled by default. Register unless explicitly
103 // disabled. 135 // disabled.
104 if (!command_line_->HasSwitch(switches::kDisableSyncApps)) { 136 if (!command_line_->HasSwitch(switches::kDisableSyncApps)) {
105 pss->RegisterDataTypeController( 137 pss->RegisterDataTypeController(
106 new ExtensionDataTypeController(syncer::APPS, this, profile_, pss)); 138 new ExtensionDataTypeController(syncer::APPS, this, profile_, pss));
107 } 139 }
108 140
109 // Autofill sync is enabled by default. Register unless explicitly 141 // Autofill sync is enabled by default. Register unless explicitly
110 // disabled. 142 // disabled.
111 if (!command_line_->HasSwitch(switches::kDisableSyncAutofill)) { 143 if (!command_line_->HasSwitch(switches::kDisableSyncAutofill)) {
112 pss->RegisterDataTypeController( 144 pss->RegisterDataTypeController(
113 new AutofillDataTypeController(this, profile_, pss)); 145 new AutofillDataTypeController(this, profile_, pss));
114 } 146 }
115 147
116 // Bookmark sync is enabled by default. Register unless explicitly
117 // disabled.
118 if (!command_line_->HasSwitch(switches::kDisableSyncBookmarks)) {
119 pss->RegisterDataTypeController(
120 new BookmarkDataTypeController(this, profile_, pss));
121 }
122
123 // Extension sync is enabled by default. Register unless explicitly 148 // Extension sync is enabled by default. Register unless explicitly
124 // disabled. 149 // disabled.
125 if (!command_line_->HasSwitch(switches::kDisableSyncExtensions)) { 150 if (!command_line_->HasSwitch(switches::kDisableSyncExtensions)) {
126 pss->RegisterDataTypeController( 151 pss->RegisterDataTypeController(
127 new ExtensionDataTypeController(syncer::EXTENSIONS, 152 new ExtensionDataTypeController(syncer::EXTENSIONS,
128 this, profile_, pss)); 153 this, profile_, pss));
129 } 154 }
130 155
131 // Password sync is enabled by default. Register unless explicitly 156 // Password sync is enabled by default. Register unless explicitly
132 // disabled. 157 // disabled.
(...skipping 10 matching lines...) Expand all
143 } 168 }
144 169
145 #if defined(ENABLE_THEMES) 170 #if defined(ENABLE_THEMES)
146 // Theme sync is enabled by default. Register unless explicitly disabled. 171 // Theme sync is enabled by default. Register unless explicitly disabled.
147 if (!command_line_->HasSwitch(switches::kDisableSyncThemes)) { 172 if (!command_line_->HasSwitch(switches::kDisableSyncThemes)) {
148 pss->RegisterDataTypeController( 173 pss->RegisterDataTypeController(
149 new ThemeDataTypeController(this, profile_, pss)); 174 new ThemeDataTypeController(this, profile_, pss));
150 } 175 }
151 #endif 176 #endif
152 177
153 // TypedUrl sync is enabled by default. Register unless explicitly disabled,
154 // or if saving history is disabled.
155 if (!profile_->GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled) &&
156 !command_line_->HasSwitch(switches::kDisableSyncTypedUrls)) {
157 pss->RegisterDataTypeController(
158 new TypedUrlDataTypeController(this, profile_, pss));
159 }
160
161 // Search Engine sync is enabled by default. Register only if explicitly 178 // Search Engine sync is enabled by default. Register only if explicitly
162 // disabled. 179 // disabled.
163 if (!command_line_->HasSwitch(switches::kDisableSyncSearchEngines)) { 180 if (!command_line_->HasSwitch(switches::kDisableSyncSearchEngines)) {
164 pss->RegisterDataTypeController( 181 pss->RegisterDataTypeController(
165 new SearchEngineDataTypeController(this, profile_, pss)); 182 new SearchEngineDataTypeController(this, profile_, pss));
166 } 183 }
167 184
168 // Session sync is enabled by default. Register unless explicitly disabled.
169 if (!command_line_->HasSwitch(switches::kDisableSyncTabs)) {
170 pss->RegisterDataTypeController(
171 new SessionDataTypeController(this, profile_, pss));
172 }
173
174 // Extension setting sync is enabled by default. Register unless explicitly 185 // Extension setting sync is enabled by default. Register unless explicitly
175 // disabled. 186 // disabled.
176 if (!command_line_->HasSwitch(switches::kDisableSyncExtensionSettings)) { 187 if (!command_line_->HasSwitch(switches::kDisableSyncExtensionSettings)) {
177 pss->RegisterDataTypeController( 188 pss->RegisterDataTypeController(
178 new ExtensionSettingDataTypeController( 189 new ExtensionSettingDataTypeController(
179 syncer::EXTENSION_SETTINGS, this, profile_, pss)); 190 syncer::EXTENSION_SETTINGS, this, profile_, pss));
180 } 191 }
181 192
182 // App setting sync is enabled by default. Register unless explicitly 193 // App setting sync is enabled by default. Register unless explicitly
183 // disabled. 194 // disabled.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 ProfileSyncComponentsFactory::SyncComponents 350 ProfileSyncComponentsFactory::SyncComponents
340 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( 351 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents(
341 ProfileSyncService* profile_sync_service, 352 ProfileSyncService* profile_sync_service,
342 DataTypeErrorHandler* error_handler) { 353 DataTypeErrorHandler* error_handler) {
343 SessionModelAssociator* model_associator = 354 SessionModelAssociator* model_associator =
344 new SessionModelAssociator(profile_sync_service, error_handler); 355 new SessionModelAssociator(profile_sync_service, error_handler);
345 SessionChangeProcessor* change_processor = 356 SessionChangeProcessor* change_processor =
346 new SessionChangeProcessor(error_handler, model_associator); 357 new SessionChangeProcessor(error_handler, model_associator);
347 return SyncComponents(model_associator, change_processor); 358 return SyncComponents(model_associator, change_processor);
348 } 359 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_components_factory_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698