OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_MODEL_ASSOCIATOR_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_MODEL_ASSOCIATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 virtual bool DisassociateModels(); | 63 virtual bool DisassociateModels(); |
64 | 64 |
65 // TODO(lipalani) Bug 64111. | 65 // TODO(lipalani) Bug 64111. |
66 // The has_nodes out param is true if the sync model has nodes other | 66 // The has_nodes out param is true if the sync model has nodes other |
67 // than the permanent tagged nodes. | 67 // than the permanent tagged nodes. |
68 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); | 68 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); |
69 | 69 |
70 // See ModelAssociator interface. | 70 // See ModelAssociator interface. |
71 virtual void AbortAssociation(); | 71 virtual void AbortAssociation(); |
72 | 72 |
73 virtual const std::string* GetChromeNodeFromSyncId( | 73 virtual const std::string* GetChromeNodeFromSyncId(int64 sync_id); |
74 int64 sync_id) { | |
75 return NULL; | |
76 } | |
77 | 74 |
78 virtual bool InitSyncNodeFromChromeId(const std::string& node_id, | 75 virtual bool InitSyncNodeFromChromeId(const std::string& node_id, |
79 sync_api::BaseNode* sync_node) { | 76 sync_api::BaseNode* sync_node); |
80 return false; | |
81 } | |
82 | 77 |
83 // Returns the sync id for the given autofill name, or sync_api::kInvalidId | 78 // Returns the sync id for the given autofill name, or sync_api::kInvalidId |
84 // if the autofill name is not associated to any sync id. | 79 // if the autofill name is not associated to any sync id. |
85 virtual int64 GetSyncIdFromChromeId(const std::string& node_id); | 80 virtual int64 GetSyncIdFromChromeId(const std::string& node_id); |
86 | 81 |
87 // Associates the given autofill name with the given sync id. | 82 // Associates the given autofill name with the given sync id. |
88 virtual void Associate(const std::string* node, int64 sync_id); | 83 virtual void Associate(const std::string* node, int64 sync_id); |
89 | 84 |
90 // Remove the association that corresponds to the given sync id. | 85 // Remove the association that corresponds to the given sync id. |
91 virtual void Disassociate(int64 sync_id); | 86 virtual void Disassociate(int64 sync_id); |
92 | 87 |
93 // TODO(lipalani) Bug 64111. Returns whether a node with the | 88 // TODO(lipalani) Bug 64111. Returns whether a node with the |
94 // given permanent tag was found and update | 89 // given permanent tag was found and update |
95 // |sync_id| with that node's id. No current use. To Implement | 90 // |sync_id| with that node's id. No current use. To Implement |
96 // only for completeness. | 91 // only for completeness. |
97 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id) { | 92 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id); |
98 return false; | |
99 } | |
100 | 93 |
101 // Returns sync service instance. | 94 // Returns sync service instance. |
102 ProfileSyncService* sync_service() { return sync_service_; } | 95 ProfileSyncService* sync_service() { return sync_service_; } |
103 | 96 |
104 protected: | 97 protected: |
105 AutofillProfileModelAssociator() {} | 98 AutofillProfileModelAssociator(); |
106 bool TraverseAndAssociateChromeAutoFillProfiles( | 99 bool TraverseAndAssociateChromeAutoFillProfiles( |
107 sync_api::WriteTransaction* write_trans, | 100 sync_api::WriteTransaction* write_trans, |
108 const sync_api::ReadNode& autofill_root, | 101 const sync_api::ReadNode& autofill_root, |
109 const std::vector<AutoFillProfile*>& all_profiles_from_db, | 102 const std::vector<AutoFillProfile*>& all_profiles_from_db, |
110 std::set<std::string>* current_profiles, | 103 std::set<std::string>* current_profiles, |
111 std::vector<AutoFillProfile*>* updated_profiles, | 104 std::vector<AutoFillProfile*>* updated_profiles, |
112 std::vector<AutoFillProfile*>* new_profiles, | 105 std::vector<AutoFillProfile*>* new_profiles, |
113 std::vector<std::string>* profiles_to_delete); | 106 std::vector<std::string>* profiles_to_delete); |
114 | 107 |
115 // Helper to insert an AutoFillProfile into the WebDatabase (e.g. in response | 108 // Helper to insert an AutoFillProfile into the WebDatabase (e.g. in response |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 std::set<std::string> current_profiles; | 182 std::set<std::string> current_profiles; |
190 std::vector<std::string> profiles_to_delete; | 183 std::vector<std::string> profiles_to_delete; |
191 std::vector<AutoFillProfile*> updated_profiles; | 184 std::vector<AutoFillProfile*> updated_profiles; |
192 std::vector<AutoFillProfile*> new_profiles; // We own these pointers. | 185 std::vector<AutoFillProfile*> new_profiles; // We own these pointers. |
193 ~DataBundle() { STLDeleteElements(&new_profiles); } | 186 ~DataBundle() { STLDeleteElements(&new_profiles); } |
194 }; | 187 }; |
195 | 188 |
196 } // namespace browser_sync | 189 } // namespace browser_sync |
197 | 190 |
198 #endif // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_MODEL_ASSOCIATOR_H_ | 191 #endif // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_MODEL_ASSOCIATOR_H_ |
OLD | NEW |