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

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

Issue 2334613003: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Changes from review by sky Created 4 years, 3 months 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 (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"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Always create the GCMProfileService instance such that we can listen to 147 // Always create the GCMProfileService instance such that we can listen to
148 // the profile notifications and purge the GCM store when the profile is 148 // the profile notifications and purge the GCM store when the profile is
149 // being signed out. 149 // being signed out.
150 gcm::GCMProfileServiceFactory::GetForProfile(profile); 150 gcm::GCMProfileServiceFactory::GetForProfile(profile);
151 151
152 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup 152 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup
153 // once http://crbug.com/171406 has been fixed. 153 // once http://crbug.com/171406 has been fixed.
154 AboutSigninInternalsFactory::GetForProfile(profile); 154 AboutSigninInternalsFactory::GetForProfile(profile);
155 155
156 init_params.signin_wrapper = 156 init_params.signin_wrapper =
157 base::WrapUnique(new SupervisedUserSigninManagerWrapper(profile, signin)); 157 base::MakeUnique<SupervisedUserSigninManagerWrapper>(profile, signin);
158 init_params.oauth2_token_service = 158 init_params.oauth2_token_service =
159 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 159 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
160 init_params.gaia_cookie_manager_service = 160 init_params.gaia_cookie_manager_service =
161 GaiaCookieManagerServiceFactory::GetForProfile(profile); 161 GaiaCookieManagerServiceFactory::GetForProfile(profile);
162 162
163 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync 163 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync
164 // is set up and *not* a browser restart for a manual-start platform (where 164 // is set up and *not* a browser restart for a manual-start platform (where
165 // sync has already been set up, and should be able to start without user 165 // sync has already been set up, and should be able to start without user
166 // intervention). We can get rid of the browser_default eventually, but 166 // intervention). We can get rid of the browser_default eventually, but
167 // need to take care that ProfileSyncService doesn't get tripped up between 167 // need to take care that ProfileSyncService doesn't get tripped up between
168 // those two cases. Bug 88109. 168 // those two cases. Bug 88109.
169 init_params.start_behavior = browser_defaults::kSyncAutoStarts 169 init_params.start_behavior = browser_defaults::kSyncAutoStarts
170 ? ProfileSyncService::AUTO_START 170 ? ProfileSyncService::AUTO_START
171 : ProfileSyncService::MANUAL_START; 171 : ProfileSyncService::MANUAL_START;
172 172
173 init_params.sync_client = 173 init_params.sync_client =
174 base::WrapUnique(new browser_sync::ChromeSyncClient(profile)); 174 base::MakeUnique<browser_sync::ChromeSyncClient>(profile);
175 175
176 init_params.network_time_update_callback = base::Bind(&UpdateNetworkTime); 176 init_params.network_time_update_callback = base::Bind(&UpdateNetworkTime);
177 init_params.base_directory = profile->GetPath(); 177 init_params.base_directory = profile->GetPath();
178 init_params.url_request_context = profile->GetRequestContext(); 178 init_params.url_request_context = profile->GetRequestContext();
179 init_params.debug_identifier = profile->GetDebugName(); 179 init_params.debug_identifier = profile->GetDebugName();
180 init_params.channel = chrome::GetChannel(); 180 init_params.channel = chrome::GetChannel();
181 181
182 init_params.db_thread = content::BrowserThread::GetTaskRunnerForThread( 182 init_params.db_thread = content::BrowserThread::GetTaskRunnerForThread(
183 content::BrowserThread::DB); 183 content::BrowserThread::DB);
184 init_params.file_thread = content::BrowserThread::GetTaskRunnerForThread( 184 init_params.file_thread = content::BrowserThread::GetTaskRunnerForThread(
185 content::BrowserThread::FILE); 185 content::BrowserThread::FILE);
186 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); 186 init_params.blocking_pool = content::BrowserThread::GetBlockingPool();
187 187
188 auto pss = base::WrapUnique(new ProfileSyncService(std::move(init_params))); 188 auto pss = base::MakeUnique<ProfileSyncService>(std::move(init_params));
189 189
190 // Will also initialize the sync client. 190 // Will also initialize the sync client.
191 pss->Initialize(); 191 pss->Initialize();
192 return pss.release(); 192 return pss.release();
193 } 193 }
194 194
195 // static 195 // static
196 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { 196 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) {
197 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; 197 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL;
198 } 198 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/chrome_sync_client.cc ('k') | chrome/browser/sync/profile_sync_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698