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

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

Issue 548373003: Move AttachmentStore ownership to datatype (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Changes after feedback. Created 6 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
8 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" 8 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h"
9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" 9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
10 #include "chrome/browser/history/history_service.h" 10 #include "chrome/browser/history/history_service.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 TokenServiceProvider::GetTokenServiceTaskRunner() { 586 TokenServiceProvider::GetTokenServiceTaskRunner() {
587 return task_runner_; 587 return task_runner_;
588 } 588 }
589 589
590 OAuth2TokenService* TokenServiceProvider::GetTokenService() { 590 OAuth2TokenService* TokenServiceProvider::GetTokenService() {
591 return token_service_; 591 return token_service_;
592 } 592 }
593 593
594 scoped_ptr<syncer::AttachmentService> 594 scoped_ptr<syncer::AttachmentService>
595 ProfileSyncComponentsFactoryImpl::CreateAttachmentService( 595 ProfileSyncComponentsFactoryImpl::CreateAttachmentService(
596 const scoped_refptr<syncer::AttachmentStore>& attachment_store,
596 const syncer::UserShare& user_share, 597 const syncer::UserShare& user_share,
597 syncer::AttachmentService::Delegate* delegate) { 598 syncer::AttachmentService::Delegate* delegate) {
598
599 scoped_ptr<syncer::AttachmentStore> attachment_store(
600 new syncer::FakeAttachmentStore(
601 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
602
603 scoped_ptr<syncer::AttachmentUploader> attachment_uploader; 599 scoped_ptr<syncer::AttachmentUploader> attachment_uploader;
604 scoped_ptr<syncer::AttachmentDownloader> attachment_downloader; 600 scoped_ptr<syncer::AttachmentDownloader> attachment_downloader;
605 // Only construct an AttachmentUploader and AttachmentDownload if we have sync 601 // Only construct an AttachmentUploader and AttachmentDownload if we have sync
606 // credentials. We may not have sync credentials because there may not be a 602 // credentials. We may not have sync credentials because there may not be a
607 // signed in sync user (e.g. sync is running in "backup" mode). 603 // signed in sync user (e.g. sync is running in "backup" mode).
608 if (!user_share.sync_credentials.email.empty() && 604 if (!user_share.sync_credentials.email.empty() &&
609 !user_share.sync_credentials.scope_set.empty()) { 605 !user_share.sync_credentials.scope_set.empty()) {
610 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> 606 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>
611 token_service_provider(new TokenServiceProvider( 607 token_service_provider(new TokenServiceProvider(
612 content::BrowserThread::GetMessageLoopProxyForThread( 608 content::BrowserThread::GetMessageLoopProxyForThread(
(...skipping 15 matching lines...) Expand all
628 token_service_); 624 token_service_);
629 attachment_downloader = syncer::AttachmentDownloader::Create( 625 attachment_downloader = syncer::AttachmentDownloader::Create(
630 sync_service_url_, 626 sync_service_url_,
631 url_request_context_getter_, 627 url_request_context_getter_,
632 user_share.sync_credentials.email, 628 user_share.sync_credentials.email,
633 user_share.sync_credentials.scope_set, 629 user_share.sync_credentials.scope_set,
634 token_service_provider); 630 token_service_provider);
635 } 631 }
636 632
637 scoped_ptr<syncer::AttachmentService> attachment_service( 633 scoped_ptr<syncer::AttachmentService> attachment_service(
638 new syncer::AttachmentServiceImpl(attachment_store.Pass(), 634 new syncer::AttachmentServiceImpl(attachment_store,
639 attachment_uploader.Pass(), 635 attachment_uploader.Pass(),
640 attachment_downloader.Pass(), 636 attachment_downloader.Pass(),
641 delegate)); 637 delegate));
642 638
643 return attachment_service.Pass(); 639 return attachment_service.Pass();
644 } 640 }
645 641
646 ProfileSyncComponentsFactory::SyncComponents 642 ProfileSyncComponentsFactory::SyncComponents
647 ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents( 643 ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents(
648 ProfileSyncService* profile_sync_service, 644 ProfileSyncService* profile_sync_service,
(...skipping 29 matching lines...) Expand all
678 new TypedUrlModelAssociator(profile_sync_service, 674 new TypedUrlModelAssociator(profile_sync_service,
679 history_backend, 675 history_backend,
680 error_handler); 676 error_handler);
681 TypedUrlChangeProcessor* change_processor = 677 TypedUrlChangeProcessor* change_processor =
682 new TypedUrlChangeProcessor(profile_, 678 new TypedUrlChangeProcessor(profile_,
683 model_associator, 679 model_associator,
684 history_backend, 680 history_backend,
685 error_handler); 681 error_handler);
686 return SyncComponents(model_associator, change_processor); 682 return SyncComponents(model_associator, change_processor);
687 } 683 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_components_factory_impl.h ('k') | chrome/browser/sync/profile_sync_components_factory_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698