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

Side by Side Diff: chrome/browser/webdata/autofill_profile_syncable_service.h

Issue 8184001: The AutofillProfileSyncableService's lifetime should be managed by the WebDataService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile after http://crrev.com/104990 Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_PROFILE_SYNCABLE_SERVICE_H_ 4 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_PROFILE_SYNCABLE_SERVICE_H_
5 #define CHROME_BROWSER_WEBDATA_AUTOFILL_PROFILE_SYNCABLE_SERVICE_H_ 5 #define CHROME_BROWSER_WEBDATA_AUTOFILL_PROFILE_SYNCABLE_SERVICE_H_
6 #pragma once 6 #pragma once
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 12 matching lines...) Expand all
23 #include "content/common/content_notification_types.h" 23 #include "content/common/content_notification_types.h"
24 #include "content/common/notification_observer.h" 24 #include "content/common/notification_observer.h"
25 #include "content/common/notification_registrar.h" 25 #include "content/common/notification_registrar.h"
26 26
27 class AutofillProfile; 27 class AutofillProfile;
28 class AutofillTable; 28 class AutofillTable;
29 class ProfileSyncServiceAutofillTest; 29 class ProfileSyncServiceAutofillTest;
30 class WebDataService; 30 class WebDataService;
31 31
32 namespace browser_sync { 32 namespace browser_sync {
33 class UnrecoverableErrorHandler;
34 }
33 35
34 extern const char kAutofillProfileTag[]; 36 extern const char kAutofillProfileTag[];
35 37
36 class UnrecoverableErrorHandler;
37
38 // The sync implementation for AutofillProfiles. 38 // The sync implementation for AutofillProfiles.
39 // MergeDataAndStartSyncing() called first, it does cloud->local and 39 // MergeDataAndStartSyncing() called first, it does cloud->local and
40 // local->cloud syncs. Then for each cloud change we receive 40 // local->cloud syncs. Then for each cloud change we receive
41 // ProcessSyncChanges() and for each local change Observe() is called. 41 // ProcessSyncChanges() and for each local change Observe() is called.
42 class AutofillProfileSyncableService 42 class AutofillProfileSyncableService
43 : public SyncableService, 43 : public SyncableService,
44 public NotificationObserver, 44 public NotificationObserver,
45 public base::NonThreadSafe { 45 public base::NonThreadSafe {
46 public: 46 public:
47 explicit AutofillProfileSyncableService(WebDataService* web_data_service); 47 explicit AutofillProfileSyncableService(WebDataService* web_data_service);
(...skipping 28 matching lines...) Expand all
76 // Made virtual for ease of mocking in the unit-test. 76 // Made virtual for ease of mocking in the unit-test.
77 // Caller owns returned |profiles|. 77 // Caller owns returned |profiles|.
78 virtual bool LoadAutofillData(std::vector<AutofillProfile*>* profiles); 78 virtual bool LoadAutofillData(std::vector<AutofillProfile*>* profiles);
79 79
80 // Helper to persist any changes that occured during model association to 80 // Helper to persist any changes that occured during model association to
81 // the WebDatabase. 81 // the WebDatabase.
82 // Made virtual for ease of mocking in the unit-test. 82 // Made virtual for ease of mocking in the unit-test.
83 virtual bool SaveChangesToWebData(const DataBundle& bundle); 83 virtual bool SaveChangesToWebData(const DataBundle& bundle);
84 84
85 private: 85 private:
86 friend class ::ProfileSyncServiceAutofillTest; 86 friend class ProfileSyncServiceAutofillTest;
87 friend class MockAutofillProfileSyncableService; 87 friend class MockAutofillProfileSyncableService;
88 FRIEND_TEST_ALL_PREFIXES(AutofillProfileSyncableServiceTest, 88 FRIEND_TEST_ALL_PREFIXES(AutofillProfileSyncableServiceTest,
89 MergeDataAndStartSyncing); 89 MergeDataAndStartSyncing);
90 FRIEND_TEST_ALL_PREFIXES(AutofillProfileSyncableServiceTest, GetAllSyncData); 90 FRIEND_TEST_ALL_PREFIXES(AutofillProfileSyncableServiceTest, GetAllSyncData);
91 FRIEND_TEST_ALL_PREFIXES(AutofillProfileSyncableServiceTest, 91 FRIEND_TEST_ALL_PREFIXES(AutofillProfileSyncableServiceTest,
92 ProcessSyncChanges); 92 ProcessSyncChanges);
93 FRIEND_TEST_ALL_PREFIXES(AutofillProfileSyncableServiceTest, 93 FRIEND_TEST_ALL_PREFIXES(AutofillProfileSyncableServiceTest,
94 ActOnChange); 94 ActOnChange);
95 95
96 // The map of the guid to profiles owned by the |profiles_| vector. 96 // The map of the guid to profiles owned by the |profiles_| vector.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // This object is used in unit-tests as well, so it defined here. 149 // This object is used in unit-tests as well, so it defined here.
150 struct AutofillProfileSyncableService::DataBundle { 150 struct AutofillProfileSyncableService::DataBundle {
151 DataBundle(); 151 DataBundle();
152 ~DataBundle(); 152 ~DataBundle();
153 153
154 std::vector<std::string> profiles_to_delete; 154 std::vector<std::string> profiles_to_delete;
155 std::vector<AutofillProfile*> profiles_to_update; 155 std::vector<AutofillProfile*> profiles_to_update;
156 std::vector<AutofillProfile*> profiles_to_add; 156 std::vector<AutofillProfile*> profiles_to_add;
157 }; 157 };
158 158
159 } // namespace browser_sync
160
161 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_PROFILE_SYNCABLE_SERVICE_H_ 159 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_PROFILE_SYNCABLE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698