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

Unified Diff: components/sync_driver/sync_client.h

Issue 1310553005: [Sync] Replace ProfileSyncComponentsFactory with SyncClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Really fix GN Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync_driver/sync_api_component_factory.h ('k') | components/sync_driver/sync_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync_driver/sync_client.h
diff --git a/components/sync_driver/sync_client.h b/components/sync_driver/sync_client.h
index 9db65bf2c3d6a56945340a2436711091ad503ac1..e8e668da7404b2dc5f73cf49d4baf8a23b50d464 100644
--- a/components/sync_driver/sync_client.h
+++ b/components/sync_driver/sync_client.h
@@ -8,9 +8,10 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "components/sync_driver/profile_sync_components_factory.h"
#include "sync/internal_api/public/base/model_type.h"
+class PrefService;
+
namespace autofill {
class AutofillWebDataService;
class AutocompleteSyncableService;
@@ -29,23 +30,28 @@ namespace password_manager {
class PasswordStore;
} // namespace password_manager
-class PrefService;
+namespace syncer {
+class SyncableService;
+} // namespace syncer
namespace sync_driver {
+class SyncApiComponentFactory;
+class SyncService;
+
// Interface for clients of the Sync API to plumb through necessary dependent
// components. This interface is purely for abstracting dependencies, and
// should not contain any non-trivial functional logic.
//
// Note: on some platforms, getters might return nullptr. Callers are expected
// to handle these scenarios gracefully.
-// TODO(zea): crbug.com/512768 Remove the ProfileSyncComponentsFactory
-// dependency once everything uses SyncClient instead, then have the SyncClient
-// include a GetSyncApiComponentsFactory getter.
-class SyncClient : public ProfileSyncComponentsFactory {
+class SyncClient {
public:
SyncClient();
+ // Returns the current SyncService instance.
+ virtual SyncService* GetSyncService() = 0;
+
// Returns the current profile's preference service.
virtual PrefService* GetPrefService() = 0;
@@ -57,8 +63,17 @@ class SyncClient : public ProfileSyncComponentsFactory {
virtual scoped_refptr<autofill::AutofillWebDataService>
GetWebDataService() = 0;
+ // Returns a weak pointer to the syncable service specified by |type|.
+ // Weak pointer may be unset if service is already destroyed.
+ // Note: Should only be called from the model type thread.
+ virtual base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType(
+ syncer::ModelType type) = 0;
+
+ // Returns the current SyncApiComponentFactory instance.
+ virtual SyncApiComponentFactory* GetSyncApiComponentFactory() = 0;
+
protected:
- ~SyncClient() override;
+ virtual ~SyncClient();
private:
DISALLOW_COPY_AND_ASSIGN(SyncClient);
« no previous file with comments | « components/sync_driver/sync_api_component_factory.h ('k') | components/sync_driver/sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698