 Chromium Code Reviews
 Chromium Code Reviews Issue 1421003007:
  [Sync] Componentize ProfileSyncComponentsFactoryImpl  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1421003007:
  [Sync] Componentize ProfileSyncComponentsFactoryImpl  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: components/browser_sync/browser/profile_sync_components_factory_impl.h | 
| diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.h b/components/browser_sync/browser/profile_sync_components_factory_impl.h | 
| similarity index 69% | 
| rename from chrome/browser/sync/profile_sync_components_factory_impl.h | 
| rename to components/browser_sync/browser/profile_sync_components_factory_impl.h | 
| index 0e7ede71bd8381ed2f76c39faed75d4772ed8033..5507b9233c24341f8071809323f24854bf91922c 100644 | 
| --- a/chrome/browser/sync/profile_sync_components_factory_impl.h | 
| +++ b/components/browser_sync/browser/profile_sync_components_factory_impl.h | 
| @@ -2,25 +2,23 @@ | 
| // Use of this source code is governed by a BSD-style license that can be | 
| // found in the LICENSE file. | 
| -#ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ | 
| -#define CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ | 
| +#ifndef COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ | 
| +#define COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ | 
| #include <string> | 
| #include "base/basictypes.h" | 
| +#include "base/command_line.h" | 
| #include "base/compiler_specific.h" | 
| #include "base/memory/weak_ptr.h" | 
| #include "components/sync_driver/sync_api_component_factory.h" | 
| +#include "components/version_info/version_info.h" | 
| #include "sync/internal_api/public/base/model_type.h" | 
| #include "url/gurl.h" | 
| class OAuth2TokenService; | 
| class Profile; | 
| -namespace base { | 
| -class CommandLine; | 
| -} | 
| - | 
| namespace net { | 
| class URLRequestContextGetter; | 
| } | 
| @@ -28,6 +26,15 @@ class URLRequestContextGetter; | 
| class ProfileSyncComponentsFactoryImpl | 
| : public sync_driver::SyncApiComponentFactory { | 
| public: | 
| + // Callback to allow platform-specific datatypes to register themselves as | 
| + // data type controllers. | 
| + // |disabled_types| and |enabled_types| control the disable/enable state of | 
| + // types that or on or off by default (respectively). | 
| 
blundell
2015/11/10 15:24:25
or on -> are on
 
Nicolas Zea
2015/11/11 00:06:20
Done.
 | 
| + typedef base::Callback<void(syncer::ModelTypeSet disabled_types, | 
| + syncer::ModelTypeSet enabled_types, | 
| + sync_driver::SyncClient* sync_client)> | 
| + RegisterDataTypesMethod; | 
| + | 
| // Constructs a ProfileSyncComponentsFactoryImpl. | 
| // | 
| // |sync_service_url| is the base URL of the sync server. | 
| @@ -37,9 +44,15 @@ class ProfileSyncComponentsFactoryImpl | 
| // |url_request_context_getter| must outlive the | 
| // ProfileSyncComponentsFactoryImpl. | 
| ProfileSyncComponentsFactoryImpl( | 
| - Profile* profile, | 
| - base::CommandLine* command_line, | 
| + const RegisterDataTypesMethod& register_platform_types_method, | 
| + version_info::Channel channel, | 
| + const std::string& version, | 
| + bool is_tablet, | 
| + const base::CommandLine& command_line, | 
| + const std::string& history_disabled_pref, | 
| const GURL& sync_service_url, | 
| + const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, | 
| + const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 
| OAuth2TokenService* token_service, | 
| net::URLRequestContextGetter* url_request_context_getter); | 
| ~ProfileSyncComponentsFactoryImpl() override; | 
| @@ -83,13 +96,6 @@ class ProfileSyncComponentsFactoryImpl | 
| sync_driver::DataTypeErrorHandler* error_handler) override; | 
| private: | 
| - // Register data types which are enabled on desktop platforms only. | 
| - // |disabled_types| and |enabled_types| correspond only to those types | 
| - // being explicitly enabled/disabled by the command line. | 
| - void RegisterDesktopDataTypes(syncer::ModelTypeSet disabled_types, | 
| - syncer::ModelTypeSet enabled_types, | 
| - sync_driver::SyncClient* sync_client); | 
| - | 
| // Register data types which are enabled on both desktop and mobile. | 
| // |disabled_types| and |enabled_types| correspond only to those types | 
| // being explicitly enabled/disabled by the command line. | 
| @@ -101,10 +107,16 @@ class ProfileSyncComponentsFactoryImpl | 
| const tracked_objects::Location& from_here, | 
| const std::string& message); | 
| - Profile* profile_; | 
| - base::CommandLine* command_line_; | 
| - | 
| + // Client/platform specific members. | 
| + const RegisterDataTypesMethod register_platform_types_method_; | 
| + const version_info::Channel channel_; | 
| + const std::string version_; | 
| + const bool is_tablet_; | 
| + const base::CommandLine command_line_; | 
| + const std::string history_disabled_pref_; | 
| 
blundell
2015/11/10 15:24:25
nit: So far we've been keeping this as a const cha
 
Nicolas Zea
2015/11/11 00:06:20
Done.
 | 
| const GURL sync_service_url_; | 
| + const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; | 
| + const scoped_refptr<base::SingleThreadTaskRunner> db_thread_; | 
| OAuth2TokenService* const token_service_; | 
| net::URLRequestContextGetter* const url_request_context_getter_; | 
| @@ -113,4 +125,4 @@ class ProfileSyncComponentsFactoryImpl | 
| DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl); | 
| }; | 
| -#endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ | 
| +#endif // COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ |