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

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

Issue 2133083002: Remove all remaining traces of MessageLoopProxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 ProfileOAuth2TokenService* token_service = 201 ProfileOAuth2TokenService* token_service =
202 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); 202 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
203 net::URLRequestContextGetter* url_request_context_getter = 203 net::URLRequestContextGetter* url_request_context_getter =
204 profile_->GetRequestContext(); 204 profile_->GetRequestContext();
205 205
206 component_factory_.reset(new ProfileSyncComponentsFactoryImpl( 206 component_factory_.reset(new ProfileSyncComponentsFactoryImpl(
207 this, chrome::GetChannel(), chrome::GetVersionString(), 207 this, chrome::GetChannel(), chrome::GetVersionString(),
208 ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET, 208 ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET,
209 *base::CommandLine::ForCurrentProcess(), 209 *base::CommandLine::ForCurrentProcess(),
210 prefs::kSavingBrowserHistoryDisabled, sync_service_url, 210 prefs::kSavingBrowserHistoryDisabled, sync_service_url,
211 content::BrowserThread::GetMessageLoopProxyForThread( 211 content::BrowserThread::GetTaskRunnerForThread(
212 content::BrowserThread::UI), 212 content::BrowserThread::UI),
213 content::BrowserThread::GetMessageLoopProxyForThread( 213 content::BrowserThread::GetTaskRunnerForThread(
214 content::BrowserThread::DB), 214 content::BrowserThread::DB),
215 token_service, url_request_context_getter, web_data_service_, 215 token_service, url_request_context_getter, web_data_service_,
216 password_store_)); 216 password_store_));
217 } 217 }
218 } 218 }
219 219
220 sync_driver::SyncService* ChromeSyncClient::GetSyncService() { 220 sync_driver::SyncService* ChromeSyncClient::GetSyncService() {
221 DCHECK_CURRENTLY_ON(BrowserThread::UI); 221 DCHECK_CURRENTLY_ON(BrowserThread::UI);
222 return ProfileSyncServiceFactory::GetSyncServiceForBrowserContext(profile_); 222 return ProfileSyncServiceFactory::GetSyncServiceForBrowserContext(profile_);
223 } 223 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 435 }
436 436
437 scoped_refptr<syncer::ModelSafeWorker> 437 scoped_refptr<syncer::ModelSafeWorker>
438 ChromeSyncClient::CreateModelWorkerForGroup( 438 ChromeSyncClient::CreateModelWorkerForGroup(
439 syncer::ModelSafeGroup group, 439 syncer::ModelSafeGroup group,
440 syncer::WorkerLoopDestructionObserver* observer) { 440 syncer::WorkerLoopDestructionObserver* observer) {
441 DCHECK_CURRENTLY_ON(BrowserThread::UI); 441 DCHECK_CURRENTLY_ON(BrowserThread::UI);
442 switch (group) { 442 switch (group) {
443 case syncer::GROUP_DB: 443 case syncer::GROUP_DB:
444 return new BrowserThreadModelWorker( 444 return new BrowserThreadModelWorker(
445 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 445 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB),
446 syncer::GROUP_DB, observer); 446 syncer::GROUP_DB, observer);
447 case syncer::GROUP_FILE: 447 case syncer::GROUP_FILE:
448 return new BrowserThreadModelWorker( 448 return new BrowserThreadModelWorker(
449 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 449 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
450 syncer::GROUP_FILE, observer); 450 syncer::GROUP_FILE, observer);
451 case syncer::GROUP_UI: 451 case syncer::GROUP_UI:
452 return new UIModelWorker( 452 return new UIModelWorker(
453 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 453 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), observer);
454 observer);
455 case syncer::GROUP_PASSIVE: 454 case syncer::GROUP_PASSIVE:
456 return new syncer::PassiveModelWorker(observer); 455 return new syncer::PassiveModelWorker(observer);
457 case syncer::GROUP_HISTORY: { 456 case syncer::GROUP_HISTORY: {
458 history::HistoryService* history_service = GetHistoryService(); 457 history::HistoryService* history_service = GetHistoryService();
459 if (!history_service) 458 if (!history_service)
460 return nullptr; 459 return nullptr;
461 return new HistoryModelWorker( 460 return new HistoryModelWorker(
462 history_service->AsWeakPtr(), 461 history_service->AsWeakPtr(),
463 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 462 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), observer);
464 observer);
465 } 463 }
466 case syncer::GROUP_PASSWORD: { 464 case syncer::GROUP_PASSWORD: {
467 if (!password_store_.get()) 465 if (!password_store_.get())
468 return nullptr; 466 return nullptr;
469 return new PasswordModelWorker(password_store_, observer); 467 return new PasswordModelWorker(password_store_, observer);
470 } 468 }
471 default: 469 default:
472 return nullptr; 470 return nullptr;
473 } 471 }
474 } 472 }
(...skipping 30 matching lines...) Expand all
505 } 503 }
506 } 504 }
507 505
508 void ChromeSyncClient::RegisterDesktopDataTypes( 506 void ChromeSyncClient::RegisterDesktopDataTypes(
509 sync_driver::SyncService* sync_service, 507 sync_driver::SyncService* sync_service,
510 syncer::ModelTypeSet disabled_types, 508 syncer::ModelTypeSet disabled_types,
511 syncer::ModelTypeSet enabled_types) { 509 syncer::ModelTypeSet enabled_types) {
512 base::Closure error_callback = 510 base::Closure error_callback =
513 base::Bind(&ChromeReportUnrecoverableError, chrome::GetChannel()); 511 base::Bind(&ChromeReportUnrecoverableError, chrome::GetChannel());
514 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread = 512 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread =
515 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); 513 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI);
516 514
517 #if defined(ENABLE_EXTENSIONS) 515 #if defined(ENABLE_EXTENSIONS)
518 // App sync is enabled by default. Register unless explicitly 516 // App sync is enabled by default. Register unless explicitly
519 // disabled. 517 // disabled.
520 if (!disabled_types.Has(syncer::APPS)) { 518 if (!disabled_types.Has(syncer::APPS)) {
521 sync_service->RegisterDataTypeController(new ExtensionDataTypeController( 519 sync_service->RegisterDataTypeController(new ExtensionDataTypeController(
522 syncer::APPS, error_callback, this, profile_)); 520 syncer::APPS, error_callback, this, profile_));
523 } 521 }
524 522
525 // Extension sync is enabled by default. Register unless explicitly 523 // Extension sync is enabled by default. Register unless explicitly
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 sync_service->RegisterDataTypeController( 620 sync_service->RegisterDataTypeController(
623 new SupervisedUserSyncDataTypeController(syncer::SUPERVISED_USER_SETTINGS, 621 new SupervisedUserSyncDataTypeController(syncer::SUPERVISED_USER_SETTINGS,
624 error_callback, this, profile_)); 622 error_callback, this, profile_));
625 sync_service->RegisterDataTypeController( 623 sync_service->RegisterDataTypeController(
626 new SupervisedUserSyncDataTypeController( 624 new SupervisedUserSyncDataTypeController(
627 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); 625 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_));
628 #endif 626 #endif
629 } 627 }
630 628
631 } // namespace browser_sync 629 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698