OLD | NEW |
---|---|
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 CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 } // namespace syncer | 24 } // namespace syncer |
25 | 25 |
26 class PasswordStore; | 26 class PasswordStore; |
27 | 27 |
28 class PasswordSyncableService : public syncer::SyncableService { | 28 class PasswordSyncableService : public syncer::SyncableService { |
29 public: | 29 public: |
30 explicit PasswordSyncableService(PasswordStore* password_store); | 30 explicit PasswordSyncableService(PasswordStore* password_store); |
31 virtual ~PasswordSyncableService(); | 31 virtual ~PasswordSyncableService(); |
32 | 32 |
33 typedef std::vector<autofill::PasswordForm*> PasswordVector; | 33 typedef std::vector<autofill::PasswordForm*> PasswordVector; |
34 typedef std::map<std::string, | |
35 std::pair<syncer::SyncChange::SyncChangeType, | |
36 std::vector<autofill::PasswordForm*>::iterator > > | |
37 PasswordEntryMap; | |
34 | 38 |
35 // syncer::SyncableServiceImplementations | 39 // syncer::SyncableServiceImplementations |
36 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | 40 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( |
37 syncer::ModelType type, | 41 syncer::ModelType type, |
38 const syncer::SyncDataList& initial_sync_data, | 42 const syncer::SyncDataList& initial_sync_data, |
39 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 43 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
40 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; | 44 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; |
41 virtual void StopSyncing(syncer::ModelType type) OVERRIDE; | 45 virtual void StopSyncing(syncer::ModelType type) OVERRIDE; |
42 virtual syncer::SyncDataList GetAllSyncData( | 46 virtual syncer::SyncDataList GetAllSyncData( |
43 syncer::ModelType type) const OVERRIDE; | 47 syncer::ModelType type) const OVERRIDE; |
44 virtual syncer::SyncError ProcessSyncChanges( | 48 virtual syncer::SyncError ProcessSyncChanges( |
45 const tracked_objects::Location& from_here, | 49 const tracked_objects::Location& from_here, |
46 const syncer::SyncChangeList& change_list) OVERRIDE; | 50 const syncer::SyncChangeList& change_list) OVERRIDE; |
47 | 51 |
48 // Static | 52 // Static |
49 static std::string MakeTag(const autofill::PasswordForm& password); | 53 static std::string MakeTag(const autofill::PasswordForm& password); |
50 // Static | 54 // Static |
51 static std::string MakeTag(const sync_pb::PasswordSpecificsData& password); | 55 static std::string MakeTag(const sync_pb::PasswordSpecificsData& password); |
52 // Static | 56 // Static |
53 static std::string MakeTag(const std::string& origin_url, | 57 static std::string MakeTag(const std::string& origin_url, |
54 const std::string& username_element, | 58 const std::string& username_element, |
55 const std::string& username_value, | 59 const std::string& username_value, |
56 const std::string& password_element, | 60 const std::string& password_element, |
57 const std::string& signon_realm); | 61 const std::string& signon_realm); |
62 // Static | |
Nicolas Zea
2013/10/15 22:04:10
Rebase onto your other patch?
lipalani1
2013/10/18 23:33:03
Done.
| |
63 static syncer::SyncData PasswordSyncableService::CreateSyncData( | |
64 const autofill::PasswordForm& password); | |
65 // Static | |
66 static void ExtractPasswordFromSpecifics( | |
67 const sync_pb::PasswordSpecificsData& password, | |
68 autofill::PasswordForm* new_password); | |
58 | 69 |
59 private: | 70 private: |
60 bool PasswordSyncableService::WriteToPasswordStore( | 71 bool PasswordSyncableService::WriteToPasswordStore( |
61 PasswordVector* new_entries, | 72 PasswordVector* new_entries, |
62 PasswordVector* udpated_entries); | 73 PasswordVector* udpated_entries); |
63 | 74 |
64 syncer::SyncData PasswordSyncableService::CreateSyncData( | 75 void CreateOrUpdateEntry( |
65 const autofill::PasswordForm& password); | 76 const syncer::SyncData& data, |
77 PasswordEntryMap* loaded_data, | |
78 std::vector<autofill::PasswordForm*>* new_entries, | |
79 std::vector<autofill::PasswordForm*>* udpated_entries); | |
80 | |
81 // Virtual so tests can override. | |
82 virtual void NotifyPasswordStore(); | |
66 | 83 |
67 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_; | 84 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_; |
68 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | 85 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; |
69 scoped_refptr<PasswordStore> password_store_; | 86 scoped_refptr<PasswordStore> password_store_; |
70 }; | 87 }; |
71 | 88 |
72 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ | 89 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_SYNCABLE_SERVICE_H__ |
73 | 90 |
OLD | NEW |