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

Side by Side Diff: components/history/core/browser/typed_url_sync_metadata_database.h

Issue 2961723003: [USS] Implement ApplySyncChanges and OnURLVisited/Modified/Deleted. (Closed)
Patch Set: handle nullptr case in bridge Created 3 years, 5 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_HISTORY_CORE_BROWSER_TYPED_URL_SYNC_METADATA_DATABASE_H_ 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_SYNC_METADATA_DATABASE_H_
6 #define COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_SYNC_METADATA_DATABASE_H_ 6 #define COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_SYNC_METADATA_DATABASE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "components/history/core/browser/url_row.h"
9 #include "components/sync/base/model_type.h" 10 #include "components/sync/base/model_type.h"
10 #include "components/sync/model/metadata_batch.h" 11 #include "components/sync/model/metadata_batch.h"
11 #include "components/sync/model/sync_metadata_store.h" 12 #include "components/sync/model/sync_metadata_store.h"
12 #include "sql/meta_table.h" 13 #include "sql/meta_table.h"
13 14
14 namespace sql { 15 namespace sql {
15 class Connection; 16 class Connection;
16 } 17 }
17 18
18 namespace history { 19 namespace history {
(...skipping 17 matching lines...) Expand all
36 bool UpdateSyncMetadata(syncer::ModelType model_type, 37 bool UpdateSyncMetadata(syncer::ModelType model_type,
37 const std::string& storage_key, 38 const std::string& storage_key,
38 const sync_pb::EntityMetadata& metadata) override; 39 const sync_pb::EntityMetadata& metadata) override;
39 bool ClearSyncMetadata(syncer::ModelType model_type, 40 bool ClearSyncMetadata(syncer::ModelType model_type,
40 const std::string& storage_key) override; 41 const std::string& storage_key) override;
41 bool UpdateModelTypeState( 42 bool UpdateModelTypeState(
42 syncer::ModelType model_type, 43 syncer::ModelType model_type,
43 const sync_pb::ModelTypeState& model_type_state) override; 44 const sync_pb::ModelTypeState& model_type_state) override;
44 bool ClearModelTypeState(syncer::ModelType model_type) override; 45 bool ClearModelTypeState(syncer::ModelType model_type) override;
45 46
47 static URLID StorageKeyToURLID(const std::string& storage_key);
48
46 protected: 49 protected:
47 // Returns the database for the functions in this interface. 50 // Returns the database for the functions in this interface.
48 virtual sql::Connection& GetDB() = 0; 51 virtual sql::Connection& GetDB() = 0;
49 52
50 // Returns MetaTable, so this sync can store ModelTypeState in MetaTable. 53 // Returns MetaTable, so this sync can store ModelTypeState in MetaTable.
51 // Check if GetMetaTable().GetVersionNumber() is greater than 0 to make sure 54 // Check if GetMetaTable().GetVersionNumber() is greater than 0 to make sure
52 // MetaTable is initialed. 55 // MetaTable is initialed.
53 virtual sql::MetaTable& GetMetaTable() = 0; 56 virtual sql::MetaTable& GetMetaTable() = 0;
54 57
55 // Called by the derived classes on initialization to make sure the tables 58 // Called by the derived classes on initialization to make sure the tables
56 // and indices are properly set up. Must be called before anything else. 59 // and indices are properly set up. Must be called before anything else.
57 bool InitSyncTable(); 60 bool InitSyncTable();
58 61
59 private: 62 private:
60 // Read all sync_pb::EntityMetadata for typed URL and fill 63 // Read all sync_pb::EntityMetadata for typed URL and fill
61 // |metadata_records| with it. 64 // |metadata_records| with it.
62 bool GetAllSyncEntityMetadata(syncer::MetadataBatch* metadata_batch); 65 bool GetAllSyncEntityMetadata(syncer::MetadataBatch* metadata_batch);
63 66
64 // Read sync_pb::ModelTypeState for typed URL and fill |state| with it. 67 // Read sync_pb::ModelTypeState for typed URL and fill |state| with it.
65 bool GetModelTypeState(sync_pb::ModelTypeState* state); 68 bool GetModelTypeState(sync_pb::ModelTypeState* state);
66 69
67 DISALLOW_COPY_AND_ASSIGN(TypedURLSyncMetadataDatabase); 70 DISALLOW_COPY_AND_ASSIGN(TypedURLSyncMetadataDatabase);
68 }; 71 };
69 72
70 } // namespace history 73 } // namespace history
71 74
72 #endif // COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_SYNC_METADATA_DATABASE_H_ 75 #endif // COMPONENTS_HISTORY_CORE_BROWSER_TYPED_URL_SYNC_METADATA_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698