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

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

Issue 1422773004: [sync] Abstract most ProfileSyncService //chrome deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pss_chrome_signin_deps
Patch Set: Fix deps 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chrome_sync_client.h" 5 #include "chrome/browser/sync/chrome_sync_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/autofill/personal_data_manager_factory.h" 8 #include "chrome/browser/autofill/personal_data_manager_factory.h"
9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
10 #include "chrome/browser/browsing_data/browsing_data_helper.h" 10 #include "chrome/browser/browsing_data/browsing_data_helper.h"
11 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" 11 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
12 #include "chrome/browser/favicon/favicon_service_factory.h" 12 #include "chrome/browser/favicon/favicon_service_factory.h"
13 #include "chrome/browser/history/history_service_factory.h" 13 #include "chrome/browser/history/history_service_factory.h"
14 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
14 #include "chrome/browser/password_manager/password_store_factory.h" 15 #include "chrome/browser/password_manager/password_store_factory.h"
15 #include "chrome/browser/prefs/pref_service_syncable_util.h" 16 #include "chrome/browser/prefs/pref_service_syncable_util.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/search_engines/template_url_service_factory.h" 18 #include "chrome/browser/search_engines/template_url_service_factory.h"
18 #include "chrome/browser/sync/glue/sync_start_util.h" 19 #include "chrome/browser/sync/glue/sync_start_util.h"
19 #include "chrome/browser/sync/profile_sync_service.h" 20 #include "chrome/browser/sync/profile_sync_service.h"
20 #include "chrome/browser/sync/profile_sync_service_factory.h" 21 #include "chrome/browser/sync/profile_sync_service_factory.h"
21 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" 22 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h"
22 #include "chrome/browser/themes/theme_service.h" 23 #include "chrome/browser/themes/theme_service.h"
23 #include "chrome/browser/themes/theme_service_factory.h" 24 #include "chrome/browser/themes/theme_service_factory.h"
24 #include "chrome/browser/themes/theme_syncable_service.h" 25 #include "chrome/browser/themes/theme_syncable_service.h"
25 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h" 26 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h"
26 #include "chrome/browser/undo/bookmark_undo_service_factory.h" 27 #include "chrome/browser/undo/bookmark_undo_service_factory.h"
27 #include "chrome/browser/web_data_service_factory.h" 28 #include "chrome/browser/web_data_service_factory.h"
29 #include "chrome/common/channel_info.h"
28 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
29 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service .h" 31 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service .h"
30 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser vice.h" 32 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser vice.h"
31 #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_sync able_service.h" 33 #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_sync able_service.h"
32 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv ice.h" 34 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv ice.h"
33 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 35 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
34 #include "components/dom_distiller/core/dom_distiller_service.h" 36 #include "components/dom_distiller/core/dom_distiller_service.h"
35 #include "components/history/core/browser/history_model_worker.h" 37 #include "components/history/core/browser/history_model_worker.h"
36 #include "components/history/core/browser/history_service.h" 38 #include "components/history/core/browser/history_service.h"
39 #include "components/invalidation/impl/profile_invalidation_provider.h"
37 #include "components/password_manager/core/browser/password_store.h" 40 #include "components/password_manager/core/browser/password_store.h"
38 #include "components/password_manager/sync/browser/password_model_worker.h" 41 #include "components/password_manager/sync/browser/password_model_worker.h"
39 #include "components/sync_driver/glue/browser_thread_model_worker.h" 42 #include "components/sync_driver/glue/browser_thread_model_worker.h"
40 #include "components/sync_driver/glue/ui_model_worker.h" 43 #include "components/sync_driver/glue/ui_model_worker.h"
41 #include "components/sync_driver/sync_api_component_factory.h" 44 #include "components/sync_driver/sync_api_component_factory.h"
42 #include "components/sync_sessions/sync_sessions_client.h" 45 #include "components/sync_sessions/sync_sessions_client.h"
43 #include "components/syncable_prefs/pref_service_syncable.h" 46 #include "components/syncable_prefs/pref_service_syncable.h"
44 #include "content/public/browser/browser_thread.h" 47 #include "content/public/browser/browser_thread.h"
45 #include "sync/internal_api/public/engine/passive_model_worker.h" 48 #include "sync/internal_api/public/engine/passive_model_worker.h"
46 49
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 ChromeSyncClient::GetWebDataService() { 214 ChromeSyncClient::GetWebDataService() {
212 DCHECK_CURRENTLY_ON(BrowserThread::UI); 215 DCHECK_CURRENTLY_ON(BrowserThread::UI);
213 return WebDataServiceFactory::GetAutofillWebDataForProfile( 216 return WebDataServiceFactory::GetAutofillWebDataForProfile(
214 profile_, ServiceAccessType::EXPLICIT_ACCESS); 217 profile_, ServiceAccessType::EXPLICIT_ACCESS);
215 } 218 }
216 219
217 BookmarkUndoService* ChromeSyncClient::GetBookmarkUndoServiceIfExists() { 220 BookmarkUndoService* ChromeSyncClient::GetBookmarkUndoServiceIfExists() {
218 return BookmarkUndoServiceFactory::GetForProfileIfExists(profile_); 221 return BookmarkUndoServiceFactory::GetForProfileIfExists(profile_);
219 } 222 }
220 223
224 invalidation::InvalidationService* ChromeSyncClient::GetInvalidationService() {
225 invalidation::ProfileInvalidationProvider* provider =
226 invalidation::ProfileInvalidationProviderFactory::GetForProfile(profile_);
227 if (provider)
228 return provider->GetInvalidationService();
229 return nullptr;
230 }
231
221 scoped_refptr<syncer::ExtensionsActivity> 232 scoped_refptr<syncer::ExtensionsActivity>
222 ChromeSyncClient::GetExtensionsActivity() { 233 ChromeSyncClient::GetExtensionsActivity() {
223 return extensions_activity_monitor_.GetExtensionsActivity(); 234 return extensions_activity_monitor_.GetExtensionsActivity();
224 } 235 }
225 236
226 sync_sessions::SyncSessionsClient* ChromeSyncClient::GetSyncSessionsClient() { 237 sync_sessions::SyncSessionsClient* ChromeSyncClient::GetSyncSessionsClient() {
227 return sync_sessions_client_.get(); 238 return sync_sessions_client_.get();
228 } 239 }
229 240
230 base::WeakPtr<syncer::SyncableService> 241 base::WeakPtr<syncer::SyncableService>
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 default: 402 default:
392 return nullptr; 403 return nullptr;
393 } 404 }
394 } 405 }
395 406
396 sync_driver::SyncApiComponentFactory* 407 sync_driver::SyncApiComponentFactory*
397 ChromeSyncClient::GetSyncApiComponentFactory() { 408 ChromeSyncClient::GetSyncApiComponentFactory() {
398 return component_factory_.get(); 409 return component_factory_.get();
399 } 410 }
400 411
412 base::FilePath ChromeSyncClient::GetBaseDirectory() {
413 return profile_->GetPath();
414 }
415
416 net::URLRequestContextGetter* ChromeSyncClient::GetURLRequestContext() {
417 return profile_->GetRequestContext();
418 }
419
420 std::string ChromeSyncClient::GetDebugIdentifier() {
421 return profile_->GetDebugName();
422 }
423
401 void ChromeSyncClient::ClearBrowsingData(base::Time start, base::Time end) { 424 void ChromeSyncClient::ClearBrowsingData(base::Time start, base::Time end) {
402 // BrowsingDataRemover deletes itself when it's done. 425 // BrowsingDataRemover deletes itself when it's done.
403 BrowsingDataRemover* remover = 426 BrowsingDataRemover* remover =
404 BrowsingDataRemover::CreateForRange(profile_, start, end); 427 BrowsingDataRemover::CreateForRange(profile_, start, end);
405 if (browsing_data_remover_observer_) 428 if (browsing_data_remover_observer_)
406 remover->AddObserver(browsing_data_remover_observer_); 429 remover->AddObserver(browsing_data_remover_observer_);
407 remover->Remove(BrowsingDataRemover::REMOVE_ALL, BrowsingDataHelper::ALL); 430 remover->Remove(BrowsingDataRemover::REMOVE_ALL, BrowsingDataHelper::ALL);
408 431
409 scoped_refptr<password_manager::PasswordStore> password = 432 scoped_refptr<password_manager::PasswordStore> password =
410 PasswordStoreFactory::GetForProfile(profile_, 433 PasswordStoreFactory::GetForProfile(profile_,
411 ServiceAccessType::EXPLICIT_ACCESS); 434 ServiceAccessType::EXPLICIT_ACCESS);
412 password->RemoveLoginsSyncedBetween(start, end); 435 password->RemoveLoginsSyncedBetween(start, end);
413 } 436 }
414 437
415 void ChromeSyncClient::SetBrowsingDataRemoverObserverForTesting( 438 void ChromeSyncClient::SetBrowsingDataRemoverObserverForTesting(
416 BrowsingDataRemover::Observer* observer) { 439 BrowsingDataRemover::Observer* observer) {
417 browsing_data_remover_observer_ = observer; 440 browsing_data_remover_observer_ = observer;
418 } 441 }
419 442
443 version_info::Channel ChromeSyncClient::GetChannel() {
444 return chrome::GetChannel();
445 }
446
447 scoped_refptr<base::SingleThreadTaskRunner> ChromeSyncClient::GetDBThread() {
448 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB);
449 }
450
451 scoped_refptr<base::SingleThreadTaskRunner> ChromeSyncClient::GetFileThread() {
452 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE);
453 }
454
455 base::SequencedWorkerPool* ChromeSyncClient::GetBlockingPool() {
456 return BrowserThread::GetBlockingPool();
457 }
458
420 } // namespace browser_sync 459 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698