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

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

Issue 272043002: Invoke AttachmentUploader and update AttachmentIds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initialize through SyncApiComponentFactory Created 6 years, 7 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "components/dom_distiller/core/dom_distiller_service.h" 52 #include "components/dom_distiller/core/dom_distiller_service.h"
53 #include "components/password_manager/core/browser/password_store.h" 53 #include "components/password_manager/core/browser/password_store.h"
54 #include "components/signin/core/browser/signin_manager.h" 54 #include "components/signin/core/browser/signin_manager.h"
55 #include "components/sync_driver/data_type_manager_impl.h" 55 #include "components/sync_driver/data_type_manager_impl.h"
56 #include "components/sync_driver/data_type_manager_observer.h" 56 #include "components/sync_driver/data_type_manager_observer.h"
57 #include "components/sync_driver/generic_change_processor.h" 57 #include "components/sync_driver/generic_change_processor.h"
58 #include "components/sync_driver/proxy_data_type_controller.h" 58 #include "components/sync_driver/proxy_data_type_controller.h"
59 #include "content/public/browser/browser_thread.h" 59 #include "content/public/browser/browser_thread.h"
60 #include "extensions/browser/extension_system.h" 60 #include "extensions/browser/extension_system.h"
61 #include "sync/api/attachments/attachment_service.h" 61 #include "sync/api/attachments/attachment_service.h"
62 #include "sync/api/attachments/attachment_service_impl.h"
62 #include "sync/api/syncable_service.h" 63 #include "sync/api/syncable_service.h"
63 #include "sync/internal_api/public/attachments/fake_attachment_store.h" 64 #include "sync/internal_api/public/attachments/fake_attachment_store.h"
65 #include "sync/internal_api/public/attachments/fake_attachment_uploader.h"
64 66
65 #if defined(ENABLE_EXTENSIONS) 67 #if defined(ENABLE_EXTENSIONS)
66 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" 68 #include "chrome/browser/extensions/api/storage/settings_sync_util.h"
67 #include "chrome/browser/extensions/extension_sync_service.h" 69 #include "chrome/browser/extensions/extension_sync_service.h"
68 #endif 70 #endif
69 71
70 #if defined(ENABLE_APP_LIST) 72 #if defined(ENABLE_APP_LIST)
71 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" 73 #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
72 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" 74 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
73 #include "ui/app_list/app_list_switches.h" 75 #include "ui/app_list/app_list_switches.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 default: 557 default:
556 // The following datatypes still need to be transitioned to the 558 // The following datatypes still need to be transitioned to the
557 // syncer::SyncableService API: 559 // syncer::SyncableService API:
558 // Bookmarks 560 // Bookmarks
559 // Typed URLs 561 // Typed URLs
560 NOTREACHED(); 562 NOTREACHED();
561 return base::WeakPtr<syncer::SyncableService>(); 563 return base::WeakPtr<syncer::SyncableService>();
562 } 564 }
563 } 565 }
564 566
565 scoped_ptr<syncer::AttachmentStore> 567 scoped_ptr<syncer::AttachmentService>
566 ProfileSyncComponentsFactoryImpl::CreateCustomAttachmentStoreForType( 568 ProfileSyncComponentsFactoryImpl::CreateAttachmentService(
567 syncer::ModelType type) { 569 syncer::AttachmentService::Delegate* delegate) {
568 scoped_ptr<syncer::AttachmentStore> store( 570 // TODO(maniscalco): Use a shared (one per profile) thread-safe instance of
571 // AttachmentUpload instead of creating a new one per AttachmentService (bug
572 // 369536).
573 scoped_ptr<syncer::AttachmentUploader> attachment_uploader(
574 new syncer::FakeAttachmentUploader);
575
576 scoped_ptr<syncer::AttachmentStore> attachment_store(
569 new syncer::FakeAttachmentStore( 577 new syncer::FakeAttachmentStore(
570 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); 578 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
571 return store.Pass(); 579
580 scoped_ptr<syncer::AttachmentService> attachment_service(
581 new syncer::AttachmentServiceImpl(
582 attachment_store.Pass(), attachment_uploader.Pass(), delegate));
583
584 return attachment_service.Pass();
572 } 585 }
573 586
574 ProfileSyncComponentsFactory::SyncComponents 587 ProfileSyncComponentsFactory::SyncComponents
575 ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents( 588 ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents(
576 ProfileSyncService* profile_sync_service, 589 ProfileSyncService* profile_sync_service,
577 DataTypeErrorHandler* error_handler) { 590 DataTypeErrorHandler* error_handler) {
578 BookmarkModel* bookmark_model = 591 BookmarkModel* bookmark_model =
579 BookmarkModelFactory::GetForProfile(profile_sync_service->profile()); 592 BookmarkModelFactory::GetForProfile(profile_sync_service->profile());
580 syncer::UserShare* user_share = profile_sync_service->GetUserShare(); 593 syncer::UserShare* user_share = profile_sync_service->GetUserShare();
581 // TODO(akalin): We may want to propagate this switch up eventually. 594 // TODO(akalin): We may want to propagate this switch up eventually.
(...skipping 24 matching lines...) Expand all
606 new TypedUrlModelAssociator(profile_sync_service, 619 new TypedUrlModelAssociator(profile_sync_service,
607 history_backend, 620 history_backend,
608 error_handler); 621 error_handler);
609 TypedUrlChangeProcessor* change_processor = 622 TypedUrlChangeProcessor* change_processor =
610 new TypedUrlChangeProcessor(profile_, 623 new TypedUrlChangeProcessor(profile_,
611 model_associator, 624 model_associator,
612 history_backend, 625 history_backend,
613 error_handler); 626 error_handler);
614 return SyncComponents(model_associator, change_processor); 627 return SyncComponents(model_associator, change_processor);
615 } 628 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698