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

Side by Side Diff: components/browser_sync/browser/profile_sync_components_factory_impl.h

Issue 1421003007: [Sync] Componentize ProfileSyncComponentsFactoryImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ 5 #ifndef COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ 6 #define COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
13 #include "components/sync_driver/sync_api_component_factory.h" 14 #include "components/sync_driver/sync_api_component_factory.h"
15 #include "components/version_info/version_info.h"
14 #include "sync/internal_api/public/base/model_type.h" 16 #include "sync/internal_api/public/base/model_type.h"
15 #include "url/gurl.h" 17 #include "url/gurl.h"
16 18
17 class OAuth2TokenService; 19 class OAuth2TokenService;
18 class Profile; 20 class Profile;
19 21
20 namespace base {
21 class CommandLine;
22 }
23
24 namespace net { 22 namespace net {
25 class URLRequestContextGetter; 23 class URLRequestContextGetter;
26 } 24 }
27 25
28 class ProfileSyncComponentsFactoryImpl 26 class ProfileSyncComponentsFactoryImpl
29 : public sync_driver::SyncApiComponentFactory { 27 : public sync_driver::SyncApiComponentFactory {
30 public: 28 public:
29 // Callback to allow platform-specific datatypes to register themselves as
30 // data type controllers.
31 // |disabled_types| and |enabled_types| control the disable/enable state of
32 // 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.
33 typedef base::Callback<void(syncer::ModelTypeSet disabled_types,
34 syncer::ModelTypeSet enabled_types,
35 sync_driver::SyncClient* sync_client)>
36 RegisterDataTypesMethod;
37
31 // Constructs a ProfileSyncComponentsFactoryImpl. 38 // Constructs a ProfileSyncComponentsFactoryImpl.
32 // 39 //
33 // |sync_service_url| is the base URL of the sync server. 40 // |sync_service_url| is the base URL of the sync server.
34 // 41 //
35 // |token_service| must outlive the ProfileSyncComponentsFactoryImpl. 42 // |token_service| must outlive the ProfileSyncComponentsFactoryImpl.
36 // 43 //
37 // |url_request_context_getter| must outlive the 44 // |url_request_context_getter| must outlive the
38 // ProfileSyncComponentsFactoryImpl. 45 // ProfileSyncComponentsFactoryImpl.
39 ProfileSyncComponentsFactoryImpl( 46 ProfileSyncComponentsFactoryImpl(
40 Profile* profile, 47 const RegisterDataTypesMethod& register_platform_types_method,
41 base::CommandLine* command_line, 48 version_info::Channel channel,
49 const std::string& version,
50 bool is_tablet,
51 const base::CommandLine& command_line,
52 const std::string& history_disabled_pref,
42 const GURL& sync_service_url, 53 const GURL& sync_service_url,
54 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
55 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread,
43 OAuth2TokenService* token_service, 56 OAuth2TokenService* token_service,
44 net::URLRequestContextGetter* url_request_context_getter); 57 net::URLRequestContextGetter* url_request_context_getter);
45 ~ProfileSyncComponentsFactoryImpl() override; 58 ~ProfileSyncComponentsFactoryImpl() override;
46 59
47 void RegisterDataTypes(sync_driver::SyncClient* sync_client) override; 60 void RegisterDataTypes(sync_driver::SyncClient* sync_client) override;
48 61
49 sync_driver::DataTypeManager* CreateDataTypeManager( 62 sync_driver::DataTypeManager* CreateDataTypeManager(
50 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 63 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
51 debug_info_listener, 64 debug_info_listener,
52 const sync_driver::DataTypeController::TypeMap* controllers, 65 const sync_driver::DataTypeController::TypeMap* controllers,
(...skipping 23 matching lines...) Expand all
76 CreateBookmarkSyncComponents( 89 CreateBookmarkSyncComponents(
77 sync_driver::SyncService* sync_service, 90 sync_driver::SyncService* sync_service,
78 sync_driver::DataTypeErrorHandler* error_handler) override; 91 sync_driver::DataTypeErrorHandler* error_handler) override;
79 sync_driver::SyncApiComponentFactory::SyncComponents 92 sync_driver::SyncApiComponentFactory::SyncComponents
80 CreateTypedUrlSyncComponents( 93 CreateTypedUrlSyncComponents(
81 sync_driver::SyncService* sync_service, 94 sync_driver::SyncService* sync_service,
82 history::HistoryBackend* history_backend, 95 history::HistoryBackend* history_backend,
83 sync_driver::DataTypeErrorHandler* error_handler) override; 96 sync_driver::DataTypeErrorHandler* error_handler) override;
84 97
85 private: 98 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. 99 // Register data types which are enabled on both desktop and mobile.
94 // |disabled_types| and |enabled_types| correspond only to those types 100 // |disabled_types| and |enabled_types| correspond only to those types
95 // being explicitly enabled/disabled by the command line. 101 // being explicitly enabled/disabled by the command line.
96 void RegisterCommonDataTypes(syncer::ModelTypeSet disabled_types, 102 void RegisterCommonDataTypes(syncer::ModelTypeSet disabled_types,
97 syncer::ModelTypeSet enabled_types, 103 syncer::ModelTypeSet enabled_types,
98 sync_driver::SyncClient* sync_client); 104 sync_driver::SyncClient* sync_client);
99 105
100 void DisableBrokenType(syncer::ModelType type, 106 void DisableBrokenType(syncer::ModelType type,
101 const tracked_objects::Location& from_here, 107 const tracked_objects::Location& from_here,
102 const std::string& message); 108 const std::string& message);
103 109
104 Profile* profile_; 110 // Client/platform specific members.
105 base::CommandLine* command_line_; 111 const RegisterDataTypesMethod register_platform_types_method_;
106 112 const version_info::Channel channel_;
113 const std::string version_;
114 const bool is_tablet_;
115 const base::CommandLine command_line_;
116 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.
107 const GURL sync_service_url_; 117 const GURL sync_service_url_;
118 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
119 const scoped_refptr<base::SingleThreadTaskRunner> db_thread_;
108 OAuth2TokenService* const token_service_; 120 OAuth2TokenService* const token_service_;
109 net::URLRequestContextGetter* const url_request_context_getter_; 121 net::URLRequestContextGetter* const url_request_context_getter_;
110 122
111 base::WeakPtrFactory<ProfileSyncComponentsFactoryImpl> weak_factory_; 123 base::WeakPtrFactory<ProfileSyncComponentsFactoryImpl> weak_factory_;
112 124
113 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl); 125 DISALLOW_COPY_AND_ASSIGN(ProfileSyncComponentsFactoryImpl);
114 }; 126 };
115 127
116 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ 128 #endif // COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_ H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698