summaryrefslogtreecommitdiffstats
path: root/chrome/browser/webdata/web_data_service.cc
diff options
context:
space:
mode:
authorskrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-07 18:53:57 +0000
committerskrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-07 18:53:57 +0000
commit83cb9e0a28d12f4c68e75dca6df33678f754e302 (patch)
treeeed727623e48bdf4f07c3a9d4e07bae682c9491f /chrome/browser/webdata/web_data_service.cc
parent4bdd8e1ead1683e5ccba967d252c0ef50ff1d722 (diff)
downloadchromium_src-83cb9e0a28d12f4c68e75dca6df33678f754e302.zip
chromium_src-83cb9e0a28d12f4c68e75dca6df33678f754e302.tar.gz
chromium_src-83cb9e0a28d12f4c68e75dca6df33678f754e302.tar.bz2
Add notification for autofill changes.
This is the first in a series of changes for adding notifications to autofill. This change adds the notification plumbing to WebDataService::AddFormFieldValues that sends a simple notification. The next change will add a Details<> payload to the notification with a list of changes that were performed, and then I will expand the notifications to the other autofill mutation methods. Review URL: http://codereview.chromium.org/455027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33970 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata/web_data_service.cc')
-rw-r--r--chrome/browser/webdata/web_data_service.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc
index fe00c5d..380613b 100644
--- a/chrome/browser/webdata/web_data_service.cc
+++ b/chrome/browser/webdata/web_data_service.cc
@@ -4,9 +4,13 @@
#include "chrome/browser/webdata/web_data_service.h"
+#include "base/message_loop.h"
+#include "base/task.h"
#include "base/thread.h"
#include "chrome/browser/webdata/web_database.h"
#include "chrome/common/chrome_constants.h"
+#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_type.h"
#include "webkit/glue/password_form.h"
////////////////////////////////////////////////////////////////////////////////
@@ -116,6 +120,12 @@ void WebDataService::CancelRequest(Handle h) {
i->second->Cancel();
}
+void WebDataService::Notify(NotificationType type) {
+ NotificationService::current()->Notify(type,
+ NotificationService::AllSources(),
+ NotificationService::NoDetails());
+}
+
void WebDataService::AddFormFieldValues(
const std::vector<FormField>& element) {
GenericRequest<std::vector<FormField> >* request =
@@ -177,6 +187,12 @@ void WebDataService::RequestCompleted(Handle h) {
consumer->OnWebDataServiceRequestDone(request->GetHandle(),
request->GetResult());
}
+
+ // If this is an autofill request, post the notifications.
+ if (!request->IsCancelled() &&
+ request->GetResult() &&
+ request->GetResult()->GetType() == AUTOFILL_VALUE_RESULT)
+ Notify(NotificationType::AUTOFILL_CHANGED);
}
//////////////////////////////////////////////////////////////////////////////