| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 static syncable::ModelType model_type() { return syncable::PASSWORDS; } | 50 static syncable::ModelType model_type() { return syncable::PASSWORDS; } |
| 51 PasswordModelAssociator(ProfileSyncService* sync_service, | 51 PasswordModelAssociator(ProfileSyncService* sync_service, |
| 52 PasswordStore* password_store, | 52 PasswordStore* password_store, |
| 53 DataTypeErrorHandler* error_handler); | 53 DataTypeErrorHandler* error_handler); |
| 54 virtual ~PasswordModelAssociator(); | 54 virtual ~PasswordModelAssociator(); |
| 55 | 55 |
| 56 // PerDataTypeAssociatorInterface implementation. | 56 // PerDataTypeAssociatorInterface implementation. |
| 57 // | 57 // |
| 58 // Iterates through the sync model looking for matched pairs of items. | 58 // Iterates through the sync model looking for matched pairs of items. |
| 59 virtual SyncError AssociateModels() OVERRIDE; | 59 virtual csync::SyncError AssociateModels() OVERRIDE; |
| 60 | 60 |
| 61 // Delete all password nodes. | 61 // Delete all password nodes. |
| 62 bool DeleteAllNodes(csync::WriteTransaction* trans); | 62 bool DeleteAllNodes(csync::WriteTransaction* trans); |
| 63 | 63 |
| 64 // Clears all associations. | 64 // Clears all associations. |
| 65 virtual SyncError DisassociateModels() OVERRIDE; | 65 virtual csync::SyncError DisassociateModels() OVERRIDE; |
| 66 | 66 |
| 67 // The has_nodes out param is true if the sync model has nodes other | 67 // The has_nodes out param is true if the sync model has nodes other |
| 68 // than the permanent tagged nodes. | 68 // than the permanent tagged nodes. |
| 69 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) OVERRIDE; | 69 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) OVERRIDE; |
| 70 | 70 |
| 71 // See ModelAssociator interface. | 71 // See ModelAssociator interface. |
| 72 virtual void AbortAssociation() OVERRIDE; | 72 virtual void AbortAssociation() OVERRIDE; |
| 73 | 73 |
| 74 // See ModelAssociator interface. | 74 // See ModelAssociator interface. |
| 75 virtual bool CryptoReadyIfNecessary() OVERRIDE; | 75 virtual bool CryptoReadyIfNecessary() OVERRIDE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 // Associates the given password name with the given sync id. | 88 // Associates the given password name with the given sync id. |
| 89 virtual void Associate(const std::string* node, int64 sync_id) OVERRIDE; | 89 virtual void Associate(const std::string* node, int64 sync_id) OVERRIDE; |
| 90 | 90 |
| 91 // Remove the association that corresponds to the given sync id. | 91 // Remove the association that corresponds to the given sync id. |
| 92 virtual void Disassociate(int64 sync_id) OVERRIDE; | 92 virtual void Disassociate(int64 sync_id) OVERRIDE; |
| 93 | 93 |
| 94 // Returns whether a node with the given permanent tag was found and update | 94 // Returns whether a node with the given permanent tag was found and update |
| 95 // |sync_id| with that node's id. | 95 // |sync_id| with that node's id. |
| 96 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id); | 96 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id); |
| 97 | 97 |
| 98 SyncError WriteToPasswordStore(const PasswordVector* new_passwords, | 98 csync::SyncError WriteToPasswordStore(const PasswordVector* new_passwords, |
| 99 const PasswordVector* updated_passwords, | 99 const PasswordVector* updated_passwords, |
| 100 const PasswordVector* deleted_passwords); | 100 const PasswordVector* deleted_passwords); |
| 101 | 101 |
| 102 static std::string MakeTag(const webkit::forms::PasswordForm& password); | 102 static std::string MakeTag(const webkit::forms::PasswordForm& password); |
| 103 static std::string MakeTag(const sync_pb::PasswordSpecificsData& password); | 103 static std::string MakeTag(const sync_pb::PasswordSpecificsData& password); |
| 104 static std::string MakeTag(const std::string& origin_url, | 104 static std::string MakeTag(const std::string& origin_url, |
| 105 const std::string& username_element, | 105 const std::string& username_element, |
| 106 const std::string& username_value, | 106 const std::string& username_value, |
| 107 const std::string& password_element, | 107 const std::string& password_element, |
| 108 const std::string& signon_realm); | 108 const std::string& signon_realm); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 139 PasswordToSyncIdMap id_map_; | 139 PasswordToSyncIdMap id_map_; |
| 140 SyncIdToPasswordMap id_map_inverse_; | 140 SyncIdToPasswordMap id_map_inverse_; |
| 141 DataTypeErrorHandler* error_handler_; | 141 DataTypeErrorHandler* error_handler_; |
| 142 | 142 |
| 143 DISALLOW_COPY_AND_ASSIGN(PasswordModelAssociator); | 143 DISALLOW_COPY_AND_ASSIGN(PasswordModelAssociator); |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 } // namespace browser_sync | 146 } // namespace browser_sync |
| 147 | 147 |
| 148 #endif // CHROME_BROWSER_SYNC_GLUE_PASSWORD_MODEL_ASSOCIATOR_H_ | 148 #endif // CHROME_BROWSER_SYNC_GLUE_PASSWORD_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |