Chromium Code Reviews| 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..336f1e2fa1b4fdc3917f32d674dd432e09e6103f |
| --- /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 AutofillTable; |
| +class AutofillWebDataBackend; |
| +class AutofillWebDataService; |
| + |
| +class AutocompleteSyncBridge : public base::SupportsUserData::Data, |
| + public syncer::ModelTypeSyncBridge, |
| + public AutofillWebDataServiceObserverOnDBThread { |
| + public: |
| + AutocompleteSyncBridge(); |
| + ~AutocompleteSyncBridge() override; |
|
maxbogue
2016/11/22 19:07:23
under both constructors plz
Patrick Noland
2016/11/29 00:09:50
Done.
|
| + AutocompleteSyncBridge( |
| + AutofillWebDataBackend* backend, |
| + const ChangeProcessorFactory& change_processor_factory); |
| + |
| + 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 |
|
maxbogue
2016/11/22 19:07:23
line above this please. sorry to be so picky about
Patrick Noland
2016/11/29 00:09:50
Done.
|
| + |
| +#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOCOMPLETE_SYNC_BRIDGE_H_ |