| OLD | NEW | 
|---|
|  | (Empty) | 
| 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 |  | 
| 3 // found in the LICENSE file. |  | 
| 4 |  | 
| 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ |  | 
| 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ |  | 
| 7 |  | 
| 8 #include <string> |  | 
| 9 |  | 
| 10 #include "base/basictypes.h" |  | 
| 11 #include "base/compiler_specific.h" |  | 
| 12 #include "base/memory/weak_ptr.h" |  | 
| 13 #include "components/sync_driver/sync_api_component_factory.h" |  | 
| 14 #include "sync/internal_api/public/base/model_type.h" |  | 
| 15 #include "url/gurl.h" |  | 
| 16 |  | 
| 17 class OAuth2TokenService; |  | 
| 18 class Profile; |  | 
| 19 |  | 
| 20 namespace base { |  | 
| 21 class CommandLine; |  | 
| 22 } |  | 
| 23 |  | 
| 24 namespace net { |  | 
| 25 class URLRequestContextGetter; |  | 
| 26 } |  | 
| 27 |  | 
| 28 class ProfileSyncComponentsFactoryImpl |  | 
| 29     : public sync_driver::SyncApiComponentFactory { |  | 
| 30  public: |  | 
| 31   // Constructs a ProfileSyncComponentsFactoryImpl. |  | 
| 32   // |  | 
| 33   // |sync_service_url| is the base URL of the sync server. |  | 
| 34   // |  | 
| 35   // |token_service| must outlive the ProfileSyncComponentsFactoryImpl. |  | 
| 36   // |  | 
| 37   // |url_request_context_getter| must outlive the |  | 
| 38   // ProfileSyncComponentsFactoryImpl. |  | 
| 39   ProfileSyncComponentsFactoryImpl( |  | 
| 40       Profile* profile, |  | 
| 41       base::CommandLine* command_line, |  | 
| 42       const GURL& sync_service_url, |  | 
| 43       OAuth2TokenService* token_service, |  | 
| 44       net::URLRequestContextGetter* url_request_context_getter); |  | 
| 45   ~ProfileSyncComponentsFactoryImpl() override; |  | 
| 46 |  | 
| 47   void RegisterDataTypes(sync_driver::SyncClient* sync_client) override; |  | 
| 48 |  | 
| 49   sync_driver::DataTypeManager* CreateDataTypeManager( |  | 
| 50       const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |  | 
| 51           debug_info_listener, |  | 
| 52       const sync_driver::DataTypeController::TypeMap* controllers, |  | 
| 53       const sync_driver::DataTypeEncryptionHandler* encryption_handler, |  | 
| 54       browser_sync::SyncBackendHost* backend, |  | 
| 55       sync_driver::DataTypeManagerObserver* observer) override; |  | 
| 56 |  | 
| 57   browser_sync::SyncBackendHost* CreateSyncBackendHost( |  | 
| 58       const std::string& name, |  | 
| 59       sync_driver::SyncClient* sync_client, |  | 
| 60       invalidation::InvalidationService* invalidator, |  | 
| 61       const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, |  | 
| 62       const base::FilePath& sync_folder) override; |  | 
| 63 |  | 
| 64   scoped_ptr<sync_driver::LocalDeviceInfoProvider> |  | 
| 65   CreateLocalDeviceInfoProvider() override; |  | 
| 66 |  | 
| 67   scoped_ptr<syncer::AttachmentService> CreateAttachmentService( |  | 
| 68       scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, |  | 
| 69       const syncer::UserShare& user_share, |  | 
| 70       const std::string& store_birthday, |  | 
| 71       syncer::ModelType model_type, |  | 
| 72       syncer::AttachmentService::Delegate* delegate) override; |  | 
| 73 |  | 
| 74   // Legacy datatypes that need to be converted to the SyncableService API. |  | 
| 75   sync_driver::SyncApiComponentFactory::SyncComponents |  | 
| 76   CreateBookmarkSyncComponents( |  | 
| 77       sync_driver::SyncService* sync_service, |  | 
| 78       sync_driver::DataTypeErrorHandler* error_handler) override; |  | 
| 79   sync_driver::SyncApiComponentFactory::SyncComponents |  | 
| 80   CreateTypedUrlSyncComponents( |  | 
| 81       sync_driver::SyncService* sync_service, |  | 
| 82       history::HistoryBackend* history_backend, |  | 
| 83       sync_driver::DataTypeErrorHandler* error_handler) override; |  | 
| 84 |  | 
| 85  private: |  | 
| 86   // Register data types which are enabled on desktop platforms only. |  | 
| 87   // |disabled_types| and |enabled_types| correspond only to those types |  | 
| 88   // being explicitly enabled/disabled by the command line. |  | 
| 89   void RegisterDesktopDataTypes(syncer::ModelTypeSet disabled_types, |  | 
| 90                                 syncer::ModelTypeSet enabled_types, |  | 
| 91                                 sync_driver::SyncClient* sync_client); |  | 
| 92 |  | 
| 93   // Register data types which are enabled on both desktop and mobile. |  | 
| 94   // |disabled_types| and |enabled_types| correspond only to those types |  | 
| 95   // being explicitly enabled/disabled by the command line. |  | 
| 96   void RegisterCommonDataTypes(syncer::ModelTypeSet disabled_types, |  | 
| 97                                syncer::ModelTypeSet enabled_types, |  | 
| 98                                sync_driver::SyncClient* sync_client); |  | 
| 99 |  | 
| 100   void DisableBrokenType(syncer::ModelType type, |  | 
| 101                          const tracked_objects::Location& from_here, |  | 
| 102                          const std::string& message); |  | 
| 103 |  | 
| 104   Profile* profile_; |  | 
| 105   base::CommandLine* command_line_; |  | 
| 106 |  | 
| 107   const GURL sync_service_url_; |  | 
| 108   OAuth2TokenService* const token_service_; |  | 
| 109   net::URLRequestContextGetter* const url_request_context_getter_; |  | 
| 110 |  | 
| 111   base::WeakPtrFactory<ProfileSyncComponentsFactoryImpl> weak_factory_; |  | 
| 112 |  | 
| 113   DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl); |  | 
| 114 }; |  | 
| 115 |  | 
| 116 #endif  // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ |  | 
| OLD | NEW | 
|---|