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