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

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: SyncableService related changes 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 TokenServiceProvider::GetTokenServiceTaskRunner() { 588 TokenServiceProvider::GetTokenServiceTaskRunner() {
589 return task_runner_; 589 return task_runner_;
590 } 590 }
591 591
592 OAuth2TokenService* TokenServiceProvider::GetTokenService() { 592 OAuth2TokenService* TokenServiceProvider::GetTokenService() {
593 return token_service_; 593 return token_service_;
594 } 594 }
595 595
596 scoped_ptr<syncer::AttachmentService> 596 scoped_ptr<syncer::AttachmentService>
597 ProfileSyncComponentsFactoryImpl::CreateAttachmentService( 597 ProfileSyncComponentsFactoryImpl::CreateAttachmentService(
598 const scoped_refptr<syncer::AttachmentStore>& attachment_store,
598 const syncer::UserShare& user_share, 599 const syncer::UserShare& user_share,
599 syncer::AttachmentService::Delegate* delegate) { 600 syncer::AttachmentService::Delegate* delegate) {
600
601 scoped_ptr<syncer::AttachmentStore> attachment_store(
602 new syncer::FakeAttachmentStore(
603 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
604
605 scoped_ptr<syncer::AttachmentUploader> attachment_uploader; 601 scoped_ptr<syncer::AttachmentUploader> attachment_uploader;
606 scoped_ptr<syncer::AttachmentDownloader> attachment_downloader; 602 scoped_ptr<syncer::AttachmentDownloader> attachment_downloader;
607 // Only construct an AttachmentUploader and AttachmentDownload if we have sync 603 // Only construct an AttachmentUploader and AttachmentDownload if we have sync
608 // credentials. We may not have sync credentials because there may not be a 604 // credentials. We may not have sync credentials because there may not be a
609 // signed in sync user (e.g. sync is running in "backup" mode). 605 // signed in sync user (e.g. sync is running in "backup" mode).
610 if (!user_share.sync_credentials.email.empty() && 606 if (!user_share.sync_credentials.email.empty() &&
611 !user_share.sync_credentials.scope_set.empty()) { 607 !user_share.sync_credentials.scope_set.empty()) {
612 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> 608 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>
613 token_service_provider(new TokenServiceProvider( 609 token_service_provider(new TokenServiceProvider(
614 content::BrowserThread::GetMessageLoopProxyForThread( 610 content::BrowserThread::GetMessageLoopProxyForThread(
(...skipping 15 matching lines...) Expand all
630 token_service_); 626 token_service_);
631 attachment_downloader = syncer::AttachmentDownloader::Create( 627 attachment_downloader = syncer::AttachmentDownloader::Create(
632 sync_service_url_, 628 sync_service_url_,
633 url_request_context_getter_, 629 url_request_context_getter_,
634 user_share.sync_credentials.email, 630 user_share.sync_credentials.email,
635 user_share.sync_credentials.scope_set, 631 user_share.sync_credentials.scope_set,
636 token_service_provider); 632 token_service_provider);
637 } 633 }
638 634
639 scoped_ptr<syncer::AttachmentService> attachment_service( 635 scoped_ptr<syncer::AttachmentService> attachment_service(
640 new syncer::AttachmentServiceImpl(attachment_store.Pass(), 636 new syncer::AttachmentServiceImpl(attachment_store,
641 attachment_uploader.Pass(), 637 attachment_uploader.Pass(),
642 attachment_downloader.Pass(), 638 attachment_downloader.Pass(),
643 delegate)); 639 delegate));
644 640
645 return attachment_service.Pass(); 641 return attachment_service.Pass();
646 } 642 }
647 643
648 ProfileSyncComponentsFactory::SyncComponents 644 ProfileSyncComponentsFactory::SyncComponents
649 ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents( 645 ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents(
650 ProfileSyncService* profile_sync_service, 646 ProfileSyncService* profile_sync_service,
(...skipping 29 matching lines...) Expand all
680 new TypedUrlModelAssociator(profile_sync_service, 676 new TypedUrlModelAssociator(profile_sync_service,
681 history_backend, 677 history_backend,
682 error_handler); 678 error_handler);
683 TypedUrlChangeProcessor* change_processor = 679 TypedUrlChangeProcessor* change_processor =
684 new TypedUrlChangeProcessor(profile_, 680 new TypedUrlChangeProcessor(profile_,
685 model_associator, 681 model_associator,
686 history_backend, 682 history_backend,
687 error_handler); 683 error_handler);
688 return SyncComponents(model_associator, change_processor); 684 return SyncComponents(model_associator, change_processor);
689 } 685 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698