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/singleton.h" | 10 #include "base/memory/singleton.h" |
10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
11 #include "components/browser_sync/browser/profile_sync_service.h" | 12 #include "components/browser_sync/browser/profile_sync_service.h" |
12 #include "components/keyed_service/ios/browser_state_dependency_manager.h" | 13 #include "components/keyed_service/ios/browser_state_dependency_manager.h" |
13 #include "components/network_time/network_time_tracker.h" | 14 #include "components/network_time/network_time_tracker.h" |
14 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 15 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
15 #include "components/signin/core/browser/signin_manager.h" | 16 #include "components/signin/core/browser/signin_manager.h" |
16 #include "components/sync_driver/signin_manager_wrapper.h" | 17 #include "components/sync_driver/signin_manager_wrapper.h" |
17 #include "components/sync_driver/startup_controller.h" | 18 #include "components/sync_driver/startup_controller.h" |
18 #include "components/sync_driver/sync_util.h" | 19 #include "components/sync_driver/sync_util.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 DependsOn(OAuth2TokenServiceFactory::GetInstance()); | 102 DependsOn(OAuth2TokenServiceFactory::GetInstance()); |
102 DependsOn(IOSChromePasswordStoreFactory::GetInstance()); | 103 DependsOn(IOSChromePasswordStoreFactory::GetInstance()); |
103 DependsOn(ios::SigninManagerFactory::GetInstance()); | 104 DependsOn(ios::SigninManagerFactory::GetInstance()); |
104 DependsOn(ios::TemplateURLServiceFactory::GetInstance()); | 105 DependsOn(ios::TemplateURLServiceFactory::GetInstance()); |
105 DependsOn(ios::WebDataServiceFactory::GetInstance()); | 106 DependsOn(ios::WebDataServiceFactory::GetInstance()); |
106 DependsOn(ios::FaviconServiceFactory::GetInstance()); | 107 DependsOn(ios::FaviconServiceFactory::GetInstance()); |
107 } | 108 } |
108 | 109 |
109 IOSChromeProfileSyncServiceFactory::~IOSChromeProfileSyncServiceFactory() {} | 110 IOSChromeProfileSyncServiceFactory::~IOSChromeProfileSyncServiceFactory() {} |
110 | 111 |
111 scoped_ptr<KeyedService> | 112 std::unique_ptr<KeyedService> |
112 IOSChromeProfileSyncServiceFactory::BuildServiceInstanceFor( | 113 IOSChromeProfileSyncServiceFactory::BuildServiceInstanceFor( |
113 web::BrowserState* context) const { | 114 web::BrowserState* context) const { |
114 ios::ChromeBrowserState* browser_state = | 115 ios::ChromeBrowserState* browser_state = |
115 ios::ChromeBrowserState::FromBrowserState(context); | 116 ios::ChromeBrowserState::FromBrowserState(context); |
116 | 117 |
117 SigninManagerBase* signin = | 118 SigninManagerBase* signin = |
118 ios::SigninManagerFactory::GetForBrowserState(browser_state); | 119 ios::SigninManagerFactory::GetForBrowserState(browser_state); |
119 | 120 |
120 // Always create the GCMProfileService instance such that we can listen to | 121 // Always create the GCMProfileService instance such that we can listen to |
121 // the profile notifications and purge the GCM store when the profile is | 122 // the profile notifications and purge the GCM store when the profile is |
122 // being signed out. | 123 // being signed out. |
123 IOSChromeGCMProfileServiceFactory::GetForBrowserState(browser_state); | 124 IOSChromeGCMProfileServiceFactory::GetForBrowserState(browser_state); |
124 | 125 |
125 // TODO(crbug.com/171406): Change AboutSigninInternalsFactory to load on | 126 // TODO(crbug.com/171406): Change AboutSigninInternalsFactory to load on |
126 // startup once bug has been fixed. | 127 // startup once bug has been fixed. |
127 ios::AboutSigninInternalsFactory::GetForBrowserState(browser_state); | 128 ios::AboutSigninInternalsFactory::GetForBrowserState(browser_state); |
128 | 129 |
129 ProfileSyncService::InitParams init_params; | 130 ProfileSyncService::InitParams init_params; |
130 init_params.signin_wrapper = | 131 init_params.signin_wrapper = |
131 make_scoped_ptr(new SigninManagerWrapper(signin)); | 132 base::WrapUnique(new SigninManagerWrapper(signin)); |
132 init_params.oauth2_token_service = | 133 init_params.oauth2_token_service = |
133 OAuth2TokenServiceFactory::GetForBrowserState(browser_state); | 134 OAuth2TokenServiceFactory::GetForBrowserState(browser_state); |
134 init_params.start_behavior = ProfileSyncService::MANUAL_START; | 135 init_params.start_behavior = ProfileSyncService::MANUAL_START; |
135 init_params.sync_client = | 136 init_params.sync_client = |
136 make_scoped_ptr(new IOSChromeSyncClient(browser_state)); | 137 base::WrapUnique(new IOSChromeSyncClient(browser_state)); |
137 init_params.network_time_update_callback = base::Bind(&UpdateNetworkTime); | 138 init_params.network_time_update_callback = base::Bind(&UpdateNetworkTime); |
138 init_params.base_directory = browser_state->GetStatePath(); | 139 init_params.base_directory = browser_state->GetStatePath(); |
139 init_params.url_request_context = browser_state->GetRequestContext(); | 140 init_params.url_request_context = browser_state->GetRequestContext(); |
140 init_params.debug_identifier = browser_state->GetDebugName(); | 141 init_params.debug_identifier = browser_state->GetDebugName(); |
141 init_params.channel = ::GetChannel(); | 142 init_params.channel = ::GetChannel(); |
142 init_params.db_thread = | 143 init_params.db_thread = |
143 web::WebThread::GetTaskRunnerForThread(web::WebThread::DB); | 144 web::WebThread::GetTaskRunnerForThread(web::WebThread::DB); |
144 init_params.file_thread = | 145 init_params.file_thread = |
145 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE); | 146 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE); |
146 init_params.blocking_pool = web::WebThread::GetBlockingPool(); | 147 init_params.blocking_pool = web::WebThread::GetBlockingPool(); |
147 | 148 |
148 auto pss = make_scoped_ptr(new ProfileSyncService(std::move(init_params))); | 149 auto pss = base::WrapUnique(new ProfileSyncService(std::move(init_params))); |
149 | 150 |
150 // Will also initialize the sync client. | 151 // Will also initialize the sync client. |
151 pss->Initialize(); | 152 pss->Initialize(); |
152 return std::move(pss); | 153 return std::move(pss); |
153 } | 154 } |
OLD | NEW |