Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h" | 5 #include "ios/chrome/browser/sync/ios_chrome_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/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "components/browser_sync/profile_sync_service.h" | 13 #include "components/browser_sync/profile_sync_service.h" |
| 14 #include "components/keyed_service/ios/browser_state_dependency_manager.h" | 14 #include "components/keyed_service/ios/browser_state_dependency_manager.h" |
| 15 #include "components/network_time/network_time_tracker.h" | 15 #include "components/network_time/network_time_tracker.h" |
| 16 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 16 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 17 #include "components/signin/core/browser/signin_manager.h" | 17 #include "components/signin/core/browser/signin_manager.h" |
| 18 #include "components/sync/driver/signin_manager_wrapper.h" | 18 #include "components/sync/driver/signin_manager_wrapper.h" |
| 19 #include "components/sync/driver/startup_controller.h" | 19 #include "components/sync/driver/startup_controller.h" |
| 20 #include "components/sync/driver/sync_util.h" | 20 #include "components/sync/driver/sync_util.h" |
| 21 #include "ios/chrome/browser/application_context.h" | 21 #include "ios/chrome/browser/application_context.h" |
| 22 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" | 22 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" |
| 23 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" | 23 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" |
| 24 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 24 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 25 #include "ios/chrome/browser/favicon/favicon_service_factory.h" | 25 #include "ios/chrome/browser/favicon/favicon_service_factory.h" |
| 26 #include "ios/chrome/browser/history/history_service_factory.h" | 26 #include "ios/chrome/browser/history/history_service_factory.h" |
| 27 #include "ios/chrome/browser/invalidation/ios_chrome_profile_invalidation_provid er_factory.h" | 27 #include "ios/chrome/browser/invalidation/ios_chrome_profile_invalidation_provid er_factory.h" |
| 28 #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" | 28 #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" |
| 29 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | |
| 29 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 30 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
| 30 #include "ios/chrome/browser/services/gcm/ios_chrome_gcm_profile_service_factory .h" | 31 #include "ios/chrome/browser/services/gcm/ios_chrome_gcm_profile_service_factory .h" |
| 31 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" | 32 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" |
| 32 #include "ios/chrome/browser/signin/about_signin_internals_factory.h" | 33 #include "ios/chrome/browser/signin/about_signin_internals_factory.h" |
| 33 #include "ios/chrome/browser/signin/oauth2_token_service_factory.h" | 34 #include "ios/chrome/browser/signin/oauth2_token_service_factory.h" |
| 34 #include "ios/chrome/browser/signin/signin_client_factory.h" | 35 #include "ios/chrome/browser/signin/signin_client_factory.h" |
| 35 #include "ios/chrome/browser/signin/signin_manager_factory.h" | 36 #include "ios/chrome/browser/signin/signin_manager_factory.h" |
| 36 #include "ios/chrome/browser/sync/ios_chrome_sync_client.h" | 37 #include "ios/chrome/browser/sync/ios_chrome_sync_client.h" |
| 38 #include "ios/chrome/browser/undo/bookmark_undo_service_factory.h" | |
| 37 #include "ios/chrome/browser/web_data_service_factory.h" | 39 #include "ios/chrome/browser/web_data_service_factory.h" |
| 38 #include "ios/chrome/common/channel_info.h" | 40 #include "ios/chrome/common/channel_info.h" |
| 39 #include "ios/web/public/web_thread.h" | 41 #include "ios/web/public/web_thread.h" |
| 40 #include "url/gurl.h" | 42 #include "url/gurl.h" |
| 41 | 43 |
| 42 using browser_sync::ProfileSyncService; | 44 using browser_sync::ProfileSyncService; |
| 43 | 45 |
| 44 namespace { | 46 namespace { |
| 45 | 47 |
| 46 void UpdateNetworkTimeOnUIThread(base::Time network_time, | 48 void UpdateNetworkTimeOnUIThread(base::Time network_time, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 return nullptr; | 88 return nullptr; |
| 87 | 89 |
| 88 return static_cast<ProfileSyncService*>( | 90 return static_cast<ProfileSyncService*>( |
| 89 GetInstance()->GetServiceForBrowserState(browser_state, false)); | 91 GetInstance()->GetServiceForBrowserState(browser_state, false)); |
| 90 } | 92 } |
| 91 | 93 |
| 92 IOSChromeProfileSyncServiceFactory::IOSChromeProfileSyncServiceFactory() | 94 IOSChromeProfileSyncServiceFactory::IOSChromeProfileSyncServiceFactory() |
| 93 : BrowserStateKeyedServiceFactory( | 95 : BrowserStateKeyedServiceFactory( |
| 94 "ProfileSyncService", | 96 "ProfileSyncService", |
| 95 BrowserStateDependencyManager::GetInstance()) { | 97 BrowserStateDependencyManager::GetInstance()) { |
| 96 // The ProfileSyncService depends on various SyncableServices being around | 98 // The ProfileSyncService depends on various SyncableServices being around |
|
sdefresne
2017/03/27 15:34:06
I think this is incorrect as if A depends on B, th
| |
| 97 // when it is shut down. Specify those dependencies here to build the proper | 99 // when it is shut down. Specify those dependencies here to build the proper |
| 98 // destruction order. | 100 // destruction order. |
| 99 DependsOn(autofill::PersonalDataManagerFactory::GetInstance()); | 101 DependsOn(autofill::PersonalDataManagerFactory::GetInstance()); |
| 100 DependsOn(ios::AboutSigninInternalsFactory::GetInstance()); | 102 DependsOn(ios::AboutSigninInternalsFactory::GetInstance()); |
| 101 DependsOn(ios::BookmarkModelFactory::GetInstance()); | 103 DependsOn(ios::BookmarkModelFactory::GetInstance()); |
| 102 DependsOn(SigninClientFactory::GetInstance()); | 104 DependsOn(ios::BookmarkUndoServiceFactory::GetInstance()); |
| 105 DependsOn(ios::FaviconServiceFactory::GetInstance()); | |
| 103 DependsOn(ios::HistoryServiceFactory::GetInstance()); | 106 DependsOn(ios::HistoryServiceFactory::GetInstance()); |
| 104 DependsOn(IOSChromeProfileInvalidationProviderFactory::GetInstance()); | |
| 105 DependsOn(OAuth2TokenServiceFactory::GetInstance()); | |
| 106 DependsOn(IOSChromePasswordStoreFactory::GetInstance()); | |
| 107 DependsOn(ios::SigninManagerFactory::GetInstance()); | 107 DependsOn(ios::SigninManagerFactory::GetInstance()); |
| 108 DependsOn(ios::TemplateURLServiceFactory::GetInstance()); | 108 DependsOn(ios::TemplateURLServiceFactory::GetInstance()); |
| 109 DependsOn(ios::WebDataServiceFactory::GetInstance()); | 109 DependsOn(ios::WebDataServiceFactory::GetInstance()); |
| 110 DependsOn(ios::FaviconServiceFactory::GetInstance()); | 110 DependsOn(IOSChromeGCMProfileServiceFactory::GetInstance()); |
| 111 DependsOn(IOSChromePasswordStoreFactory::GetInstance()); | |
| 112 DependsOn(IOSChromeProfileInvalidationProviderFactory::GetInstance()); | |
| 113 DependsOn(OAuth2TokenServiceFactory::GetInstance()); | |
| 114 DependsOn(ReadingListModelFactory::GetInstance()); | |
| 115 DependsOn(SigninClientFactory::GetInstance()); | |
| 111 } | 116 } |
| 112 | 117 |
| 113 IOSChromeProfileSyncServiceFactory::~IOSChromeProfileSyncServiceFactory() {} | 118 IOSChromeProfileSyncServiceFactory::~IOSChromeProfileSyncServiceFactory() {} |
| 114 | 119 |
| 115 std::unique_ptr<KeyedService> | 120 std::unique_ptr<KeyedService> |
| 116 IOSChromeProfileSyncServiceFactory::BuildServiceInstanceFor( | 121 IOSChromeProfileSyncServiceFactory::BuildServiceInstanceFor( |
| 117 web::BrowserState* context) const { | 122 web::BrowserState* context) const { |
| 118 ios::ChromeBrowserState* browser_state = | 123 ios::ChromeBrowserState* browser_state = |
| 119 ios::ChromeBrowserState::FromBrowserState(context); | 124 ios::ChromeBrowserState::FromBrowserState(context); |
| 120 | 125 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 143 init_params.debug_identifier = browser_state->GetDebugName(); | 148 init_params.debug_identifier = browser_state->GetDebugName(); |
| 144 init_params.channel = ::GetChannel(); | 149 init_params.channel = ::GetChannel(); |
| 145 | 150 |
| 146 auto pss = base::MakeUnique<ProfileSyncService>(std::move(init_params)); | 151 auto pss = base::MakeUnique<ProfileSyncService>(std::move(init_params)); |
| 147 | 152 |
| 148 // Will also initialize the sync client. | 153 // Will also initialize the sync client. |
| 149 pss->Initialize(); | 154 pss->Initialize(); |
| 150 // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required. | 155 // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required. |
| 151 return std::move(pss); | 156 return std::move(pss); |
| 152 } | 157 } |
| OLD | NEW |