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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
11 #include "base/metrics/histogram_macros.h" | |
12 #include "base/path_service.h" | |
13 #include "base/syslog_logging.h" | |
11 #include "base/threading/sequenced_worker_pool.h" | 14 #include "base/threading/sequenced_worker_pool.h" |
12 #include "base/time/time.h" | 15 #include "base/time/time.h" |
13 #include "build/build_config.h" | 16 #include "build/build_config.h" |
14 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 17 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
16 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/defaults.h" | 20 #include "chrome/browser/defaults.h" |
18 #include "chrome/browser/gcm/gcm_profile_service_factory.h" | 21 #include "chrome/browser/gcm/gcm_profile_service_factory.h" |
19 #include "chrome/browser/history/history_service_factory.h" | 22 #include "chrome/browser/history/history_service_factory.h" |
20 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 23 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
21 #include "chrome/browser/password_manager/password_store_factory.h" | 24 #include "chrome/browser/password_manager/password_store_factory.h" |
22 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
24 #include "chrome/browser/search_engines/template_url_service_factory.h" | 27 #include "chrome/browser/search_engines/template_url_service_factory.h" |
25 #include "chrome/browser/signin/about_signin_internals_factory.h" | 28 #include "chrome/browser/signin/about_signin_internals_factory.h" |
26 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 29 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
27 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" | 30 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" |
28 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 31 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
29 #include "chrome/browser/signin/signin_manager_factory.h" | 32 #include "chrome/browser/signin/signin_manager_factory.h" |
30 #include "chrome/browser/sync/chrome_sync_client.h" | 33 #include "chrome/browser/sync/chrome_sync_client.h" |
31 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | 34 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
32 #include "chrome/browser/themes/theme_service_factory.h" | 35 #include "chrome/browser/themes/theme_service_factory.h" |
33 #include "chrome/browser/web_data_service_factory.h" | 36 #include "chrome/browser/web_data_service_factory.h" |
34 #include "chrome/common/channel_info.h" | 37 #include "chrome/common/channel_info.h" |
38 #include "chrome/common/chrome_paths.h" | |
35 #include "components/browser_sync/profile_sync_components_factory_impl.h" | 39 #include "components/browser_sync/profile_sync_components_factory_impl.h" |
36 #include "components/browser_sync/profile_sync_service.h" | 40 #include "components/browser_sync/profile_sync_service.h" |
37 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 41 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
38 #include "components/network_time/network_time_tracker.h" | 42 #include "components/network_time/network_time_tracker.h" |
39 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 43 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
40 #include "components/signin/core/browser/signin_manager.h" | 44 #include "components/signin/core/browser/signin_manager.h" |
41 #include "components/sync/driver/signin_manager_wrapper.h" | 45 #include "components/sync/driver/signin_manager_wrapper.h" |
42 #include "components/sync/driver/startup_controller.h" | 46 #include "components/sync/driver/startup_controller.h" |
43 #include "components/sync/driver/sync_util.h" | 47 #include "components/sync/driver/sync_util.h" |
44 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 blocking_pool->GetSequenceToken(), | 164 blocking_pool->GetSequenceToken(), |
161 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 165 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
162 | 166 |
163 bool local_sync_backend_enabled = false; | 167 bool local_sync_backend_enabled = false; |
164 | 168 |
165 // Since the local sync backend is currently only supported on Windows don't | 169 // Since the local sync backend is currently only supported on Windows don't |
166 // even check the pref on other os-es. | 170 // even check the pref on other os-es. |
167 #if defined(OS_WIN) | 171 #if defined(OS_WIN) |
168 syncer::SyncPrefs prefs(profile->GetPrefs()); | 172 syncer::SyncPrefs prefs(profile->GetPrefs()); |
169 local_sync_backend_enabled = prefs.IsLocalSyncEnabled(); | 173 local_sync_backend_enabled = prefs.IsLocalSyncEnabled(); |
174 init_params.local_sync_backend_folder = prefs.GetLocalSyncBackendDir(); | |
175 if (init_params.local_sync_backend_folder.empty()) { | |
176 if (!base::PathService::Get(chrome::DIR_ROAMING_USER_DATA, | |
177 &init_params.local_sync_backend_folder)) { | |
178 SYSLOG(WARNING) << "Local sync can not get the roaming profile folder."; | |
Nicolas Zea
2017/02/21 23:58:40
Out of curiosity why SYSLOG instead of LOG?
pastarmovj
2017/02/22 14:23:14
I think this is an actionable error and the admin
| |
179 UMA_HISTOGRAM_BOOLEAN("Sync.Local.RoamingProfileUnavailable", false); | |
Nicolas Zea
2017/02/21 23:58:40
It seems like this should probably be part of a la
pastarmovj
2017/02/22 14:23:13
Sorry this one got broken when I was moving the co
| |
180 local_sync_backend_enabled = false; | |
Nicolas Zea
2017/02/21 23:58:40
Should we just return a nullptr here?
pastarmovj
2017/02/22 14:23:14
Great idea! I forgot a service doesn't have to be
| |
181 } | |
182 } | |
183 UMA_HISTOGRAM_BOOLEAN("Sync.Local.Enabled", local_sync_backend_enabled); | |
184 | |
170 if (local_sync_backend_enabled) { | 185 if (local_sync_backend_enabled) { |
171 // This code as it is now will assume the same profile order is present on | 186 // This code as it is now will assume the same profile order is present on |
172 // all machines, which is not a given. It is to be defined if only the | 187 // all machines, which is not a given. It is to be defined if only the |
173 // Default profile should get this treatment or all profile as is the case | 188 // Default profile should get this treatment or all profile as is the case |
174 // now. The solution for now will be to assume profiles are created in the | 189 // now. The solution for now will be to assume profiles are created in the |
175 // same order on all machines and in the future decide if only the Default | 190 // same order on all machines and in the future decide if only the Default |
176 // one should be considered roamed. | 191 // one should be considered roamed. |
177 init_params.local_sync_backend_folder = prefs.GetLocalSyncBackendDir(); | 192 // See http://crbug.com/674928. |
178 init_params.local_sync_backend_folder = | 193 init_params.local_sync_backend_folder = |
179 init_params.local_sync_backend_folder.Append( | 194 init_params.local_sync_backend_folder.Append( |
180 init_params.base_directory.BaseName()); | 195 init_params.base_directory.BaseName()); |
181 init_params.local_sync_backend_folder = | 196 init_params.local_sync_backend_folder = |
182 init_params.local_sync_backend_folder.Append( | 197 init_params.local_sync_backend_folder.Append( |
183 kLoopbackServerBackendFilename); | 198 kLoopbackServerBackendFilename); |
184 | 199 |
185 init_params.start_behavior = ProfileSyncService::AUTO_START; | 200 init_params.start_behavior = ProfileSyncService::AUTO_START; |
186 } | 201 } |
187 #endif // defined(OS_WIN) | 202 #endif // defined(OS_WIN) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 | 252 |
238 // static | 253 // static |
239 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( | 254 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( |
240 SyncClientFactory* client_factory) { | 255 SyncClientFactory* client_factory) { |
241 client_factory_ = client_factory; | 256 client_factory_ = client_factory; |
242 } | 257 } |
243 | 258 |
244 // static | 259 // static |
245 ProfileSyncServiceFactory::SyncClientFactory* | 260 ProfileSyncServiceFactory::SyncClientFactory* |
246 ProfileSyncServiceFactory::client_factory_ = nullptr; | 261 ProfileSyncServiceFactory::client_factory_ = nullptr; |
OLD | NEW |