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

Unified Diff: components/autofill/core/browser/webdata/autocomplete_sync_bridge.h

Issue 2508263003: [sync] skeleton implementation of AutocompleteSyncBridge (Closed)
Patch Set: Max's comments; merged chrome_sync_client Created 4 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/webdata/autocomplete_sync_bridge.h
diff --git a/components/autofill/core/browser/webdata/autocomplete_sync_bridge.h b/components/autofill/core/browser/webdata/autocomplete_sync_bridge.h
new file mode 100644
index 0000000000000000000000000000000000000000..7555af92227ba34c331b1caaf27410a221c95aa3
--- /dev/null
+++ b/components/autofill/core/browser/webdata/autocomplete_sync_bridge.h
@@ -0,0 +1,79 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
+#define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
+
+#include "base/scoped_observer.h"
+#include "base/supports_user_data.h"
+#include "base/threading/non_thread_safe.h"
+#include "components/autofill/core/browser/webdata/autofill_change.h"
+#include "components/autofill/core/browser/webdata/autofill_webdata_service_observer.h"
+#include "components/sync/model/metadata_change_list.h"
+#include "components/sync/model/model_type_sync_bridge.h"
+
+namespace syncer {
+class SyncError;
+}
+
+namespace autofill {
+
+class AutofillWebDataBackend;
+class AutofillWebDataService;
+
+class AutocompleteSyncBridge : public base::SupportsUserData::Data,
+ public syncer::ModelTypeSyncBridge,
+ public AutofillWebDataServiceObserverOnDBThread {
+ public:
+ AutocompleteSyncBridge();
+ AutocompleteSyncBridge(
+ AutofillWebDataBackend* backend,
+ const ChangeProcessorFactory& change_processor_factory);
+ ~AutocompleteSyncBridge() override;
+
+ static void CreateForWebDataServiceAndBackend(
+ AutofillWebDataService* web_data_service,
+ AutofillWebDataBackend* web_data_backend);
+
+ static AutocompleteSyncBridge* FromWebDataService(
+ AutofillWebDataService* web_data_service);
+
+ // syncer::ModelTypeService implementation.
+ std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
+ override;
+ syncer::SyncError MergeSyncData(
+ std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
+ syncer::EntityDataMap entity_data_map) override;
+ syncer::SyncError ApplySyncChanges(
+ std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
+ syncer::EntityChangeList entity_changes) override;
+ void GetData(StorageKeyList storage_keys, DataCallback callback) override;
+ void GetAllData(DataCallback callback) override;
+ // Generate a tag that uniquely identifies |entity_data| across all data
+ // types. This is used to identify the entity on the server. The format, which
+ // must remain the same for server compatibility, is:
+ // "autofill_entry|$name|$value" where $name and $value are escaped.
+ std::string GetClientTag(const syncer::EntityData& entity_data) override;
+ // Generate a string key uniquely identifying |entity_data| in the context of
+ // local storage. The format, which should stay the same, is $name|$value"
+ // where $name and $value are escaped.
+ std::string GetStorageKey(const syncer::EntityData& entity_data) override;
+
+ // AutofillWebDataServiceObserverOnDBThread implementation.
+ void AutofillEntriesChanged(const AutofillChangeList& changes) override;
+
+ private:
+ base::ThreadChecker thread_checker_;
+
+ // AutocompleteSyncBridge is owned by |web_data_backend_| through
+ // SupportsUserData, so it's guaranteed to outlive |this|.
+ AutofillWebDataBackend* const web_data_backend_;
+
+ ScopedObserver<AutofillWebDataBackend, AutocompleteSyncBridge>
+ scoped_observer_;
+};
+
+} // namespace autofill
+
+#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_
« no previous file with comments | « components/autofill/core/browser/BUILD.gn ('k') | components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698