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

Side by Side Diff: components/autofill/core/browser/webdata/autofill_table.h

Issue 2794413002: [USS] Add SyncMetadataStore interface (Closed)
Patch Set: update names Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "components/sync/base/model_type.h" 17 #include "components/sync/base/model_type.h"
18 #include "components/sync/model/metadata_batch.h" 18 #include "components/sync/model/metadata_batch.h"
19 #include "components/sync/model/sync_metadata_store.h"
19 #include "components/webdata/common/web_database_table.h" 20 #include "components/webdata/common/web_database_table.h"
20 21
21 class WebDatabase; 22 class WebDatabase;
22 23
23 namespace base { 24 namespace base {
24 class Time; 25 class Time;
25 } 26 }
26 27
27 namespace autofill { 28 namespace autofill {
28 29
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // storage_key A string that uniquely identifies the metadata record 243 // storage_key A string that uniquely identifies the metadata record
243 // as well as the corresponding autofill record. 244 // as well as the corresponding autofill record.
244 // value The serialized EntityMetadata record. 245 // value The serialized EntityMetadata record.
245 // 246 //
246 // autofill_model_type_state 247 // autofill_model_type_state
247 // Single row table that contains the sync ModelTypeState 248 // Single row table that contains the sync ModelTypeState
248 // for the autofill model type. 249 // for the autofill model type.
249 // 250 //
250 // value The serialized ModelTypeState record. 251 // value The serialized ModelTypeState record.
251 252
252 class AutofillTable : public WebDatabaseTable { 253 class AutofillTable : public WebDatabaseTable,
254 public syncer::SyncMetadataStore {
253 public: 255 public:
254 AutofillTable(); 256 AutofillTable();
255 ~AutofillTable() override; 257 ~AutofillTable() override;
256 258
257 // Retrieves the AutofillTable* owned by |db|. 259 // Retrieves the AutofillTable* owned by |db|.
258 static AutofillTable* FromWebDatabase(WebDatabase* db); 260 static AutofillTable* FromWebDatabase(WebDatabase* db);
259 261
260 // WebDatabaseTable: 262 // WebDatabaseTable:
261 WebDatabaseTable::TypeKey GetTypeKey() const override; 263 WebDatabaseTable::TypeKey GetTypeKey() const override;
262 bool CreateTablesIfNecessary() override; 264 bool CreateTablesIfNecessary() override;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 bool AddAutofillGUIDToTrash(const std::string& guid); 421 bool AddAutofillGUIDToTrash(const std::string& guid);
420 422
421 // Clear all profiles. 423 // Clear all profiles.
422 bool ClearAutofillProfiles(); 424 bool ClearAutofillProfiles();
423 425
424 // Read all the stored metadata for |model_type| and fill |metadata_batch| 426 // Read all the stored metadata for |model_type| and fill |metadata_batch|
425 // with it. 427 // with it.
426 bool GetAllSyncMetadata(syncer::ModelType model_type, 428 bool GetAllSyncMetadata(syncer::ModelType model_type,
427 syncer::MetadataBatch* metadata_batch); 429 syncer::MetadataBatch* metadata_batch);
428 430
429 // Update the metadata row for |model_type|, keyed by |storage_key|, to 431 // syncer::SyncMetadataStore implementation.
430 // contain the contents of |metadata|.
431 bool UpdateSyncMetadata(syncer::ModelType model_type, 432 bool UpdateSyncMetadata(syncer::ModelType model_type,
432 const std::string& storage_key, 433 const std::string& storage_key,
433 const sync_pb::EntityMetadata& metadata); 434 const sync_pb::EntityMetadata& metadata) override;
434
435 // Remove the metadata row of type |model_type| keyed by |storage|key|.
436 bool ClearSyncMetadata(syncer::ModelType model_type, 435 bool ClearSyncMetadata(syncer::ModelType model_type,
437 const std::string& storage_key); 436 const std::string& storage_key) override;
438 437 bool UpdateModelTypeState(
439 // Update the stored sync state for the |model_type|. 438 syncer::ModelType model_type,
440 bool UpdateModelTypeState(syncer::ModelType model_type, 439 const sync_pb::ModelTypeState& model_type_state) override;
441 const sync_pb::ModelTypeState& model_type_state); 440 bool ClearModelTypeState(syncer::ModelType model_type) override;
442
443 // Clear the stored sync state for |model_type|.
444 bool ClearModelTypeState(syncer::ModelType model_type);
445 441
446 // Table migration functions. NB: These do not and should not rely on other 442 // Table migration functions. NB: These do not and should not rely on other
447 // functions in this class. The implementation of a function such as 443 // functions in this class. The implementation of a function such as
448 // GetCreditCard may change over time, but MigrateToVersionXX should never 444 // GetCreditCard may change over time, but MigrateToVersionXX should never
449 // change. 445 // change.
450 bool MigrateToVersion54AddI18nFieldsAndRemoveDeprecatedFields(); 446 bool MigrateToVersion54AddI18nFieldsAndRemoveDeprecatedFields();
451 bool MigrateToVersion55MergeAutofillDatesTable(); 447 bool MigrateToVersion55MergeAutofillDatesTable();
452 bool MigrateToVersion56AddProfileLanguageCodeForFormatting(); 448 bool MigrateToVersion56AddProfileLanguageCodeForFormatting();
453 bool MigrateToVersion57AddFullNameField(); 449 bool MigrateToVersion57AddFullNameField();
454 bool MigrateToVersion60AddServerCards(); 450 bool MigrateToVersion60AddServerCards();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 bool InitModelTypeStateTable(); 544 bool InitModelTypeStateTable();
549 545
550 std::unique_ptr<AutofillTableEncryptor> autofill_table_encryptor_; 546 std::unique_ptr<AutofillTableEncryptor> autofill_table_encryptor_;
551 547
552 DISALLOW_COPY_AND_ASSIGN(AutofillTable); 548 DISALLOW_COPY_AND_ASSIGN(AutofillTable);
553 }; 549 };
554 550
555 } // namespace autofill 551 } // namespace autofill
556 552
557 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ 553 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/webdata/autofill_metadata_change_list.cc ('k') | components/sync/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698