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

Unified Diff: chrome/browser/webdata/web_data_service.h

Issue 12476031: Refactor notifications of chrome/browser/webdata (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/webdata/web_data_service.h
diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h
index 6bb2c7db9cd209f6fef499a5b79180e21914febf..e67d2a7d601f2c54a8c5faeaa7ed85648f5b17d7 100644
--- a/chrome/browser/webdata/web_data_service.h
+++ b/chrome/browser/webdata/web_data_service.h
@@ -11,15 +11,15 @@
#include <map>
#include <string>
-#include <vector>
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/memory/ref_counted.h"
+#include "base/observer_list.h"
#include "base/sequenced_task_runner_helpers.h"
#include "base/synchronization/lock.h"
-#include "chrome/browser/api/webdata/autofill_web_data_service.h"
+#include "chrome/browser/api/webdata/autofill_web_data.h"
#include "chrome/browser/api/webdata/web_data_results.h"
#include "chrome/browser/api/webdata/web_data_service_base.h"
#include "chrome/browser/api/webdata/web_data_service_consumer.h"
@@ -29,12 +29,15 @@
#include "chrome/browser/webdata/keyword_table.h"
#include "chrome/browser/webdata/web_data_request_manager.h"
#include "chrome/browser/webdata/web_database.h"
+#include "components/autofill/common/form_field_data.h"
#include "content/public/browser/browser_thread.h"
#include "sql/init_status.h"
class AutocompleteSyncableService;
class AutofillChange;
+class AutofillProfile;
class AutofillProfileSyncableService;
+class CreditCard;
struct DefaultWebIntentService;
class GURL;
#if defined(OS_WIN)
@@ -69,8 +72,6 @@ struct WebIntentServiceData;
//
////////////////////////////////////////////////////////////////////////////////
-typedef std::vector<AutofillChange> AutofillChangeList;
-
typedef base::Callback<scoped_ptr<WDTypedResult>(void)> ResultTask;
// Result from GetWebAppImages.
@@ -98,6 +99,7 @@ struct WDKeywordsResult {
};
class WebDataServiceConsumer;
+class WebDataServiceObserver;
class WebDataService
: public WebDataServiceBase,
@@ -108,7 +110,6 @@ class WebDataService
// WebDataServiceBase implementation.
virtual void CancelRequest(Handle h) OVERRIDE;
- virtual content::NotificationSource GetNotificationSource() OVERRIDE;
// Notifies listeners on the UI thread that multiple changes have been made to
// to Autofill records of the database.
@@ -305,6 +306,9 @@ class WebDataService
virtual AutocompleteSyncableService*
GetAutocompleteSyncableService() const;
+ void AddObserver(WebDataServiceObserver* observer);
+ void RemoveObserver(WebDataServiceObserver* observer);
+
protected:
friend class TemplateURLServiceTest;
friend class TemplateURLServiceTestingProfile;
@@ -318,6 +322,8 @@ class WebDataService
// The following methods are only invoked in the web data service thread.
//
//////////////////////////////////////////////////////////////////////////////
+ void NotifyDatabaseLoadedOnUIThread();
dhollowa 2013/03/12 22:22:28 It looks like you made this protected for use by t
kaiwang 2013/03/13 04:57:20 But it's FakeWebDataService in an anonymous namesp
dhollowa 2013/03/13 16:15:28 Ok.
+
private:
friend struct content::BrowserThread::DeleteOnThread<
content::BrowserThread::UI>;
@@ -330,7 +336,6 @@ class WebDataService
void ShutdownSyncableServices();
void DBInitFailed(sql::InitStatus sql_status);
- void NotifyDatabaseLoadedOnUIThread();
void OnDatabaseInit(sql::InitStatus status);
//////////////////////////////////////////////////////////////////////////////
@@ -445,6 +450,7 @@ class WebDataService
WebDatabase::State RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl(
const base::Time& delete_begin, const base::Time& delete_end,
WebDatabase* db);
+ void NotifyAutofillMultipleChangedOnUIThread();
// Callbacks to ensure that sensitive info is destroyed if request is
// cancelled.
@@ -465,6 +471,8 @@ class WebDataService
AutocompleteSyncableService* autocomplete_syncable_service_;
AutofillProfileSyncableService* autofill_profile_syncable_service_;
+ ObserverList<WebDataServiceObserver> observer_list_;
+
DISALLOW_COPY_AND_ASSIGN(WebDataService);
};

Powered by Google App Engine
This is Rietveld 408576698