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_PASSWORD_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_PASSWORD_MODEL_ASSOCIATOR_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_PASSWORD_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_PASSWORD_MODEL_ASSOCIATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 static bool MergePasswords(const sync_pb::PasswordSpecificsData& password, | 110 static bool MergePasswords(const sync_pb::PasswordSpecificsData& password, |
111 const webkit_glue::PasswordForm& password_form, | 111 const webkit_glue::PasswordForm& password_form, |
112 webkit_glue::PasswordForm* new_password); | 112 webkit_glue::PasswordForm* new_password); |
113 static void WriteToSyncNode(const webkit_glue::PasswordForm& password_form, | 113 static void WriteToSyncNode(const webkit_glue::PasswordForm& password_form, |
114 sync_api::WriteNode* node); | 114 sync_api::WriteNode* node); |
115 | 115 |
116 // Called at various points in model association to determine if the | 116 // Called at various points in model association to determine if the |
117 // user requested an abort. | 117 // user requested an abort. |
118 bool IsAbortPending(); | 118 bool IsAbortPending(); |
119 | 119 |
120 protected: | |
121 // Returns sync service instance. | |
122 ProfileSyncService* sync_service() { return sync_service_; } | |
123 | |
124 private: | 120 private: |
125 typedef std::map<std::string, int64> PasswordToSyncIdMap; | 121 typedef std::map<std::string, int64> PasswordToSyncIdMap; |
126 typedef std::map<int64, std::string> SyncIdToPasswordMap; | 122 typedef std::map<int64, std::string> SyncIdToPasswordMap; |
127 | 123 |
128 ProfileSyncService* sync_service_; | 124 ProfileSyncService* sync_service_; |
129 PasswordStore* password_store_; | 125 PasswordStore* password_store_; |
130 int64 password_node_id_; | 126 int64 password_node_id_; |
131 | 127 |
132 // Abort association pending flag and lock. If this is set to true | 128 // Abort association pending flag and lock. If this is set to true |
133 // (via the AbortAssociation method), return from the | 129 // (via the AbortAssociation method), return from the |
134 // AssociateModels method as soon as possible. | 130 // AssociateModels method as soon as possible. |
135 base::Lock abort_association_pending_lock_; | 131 base::Lock abort_association_pending_lock_; |
136 bool abort_association_pending_; | 132 bool abort_association_pending_; |
137 | 133 |
138 MessageLoop* expected_loop_; | 134 MessageLoop* expected_loop_; |
139 | 135 |
140 PasswordToSyncIdMap id_map_; | 136 PasswordToSyncIdMap id_map_; |
141 SyncIdToPasswordMap id_map_inverse_; | 137 SyncIdToPasswordMap id_map_inverse_; |
142 | 138 |
143 DISALLOW_COPY_AND_ASSIGN(PasswordModelAssociator); | 139 DISALLOW_COPY_AND_ASSIGN(PasswordModelAssociator); |
144 }; | 140 }; |
145 | 141 |
146 } // namespace browser_sync | 142 } // namespace browser_sync |
147 | 143 |
148 #endif // CHROME_BROWSER_SYNC_GLUE_PASSWORD_MODEL_ASSOCIATOR_H_ | 144 #endif // CHROME_BROWSER_SYNC_GLUE_PASSWORD_MODEL_ASSOCIATOR_H_ |
OLD | NEW |