diff options
author | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-07 18:53:57 +0000 |
---|---|---|
committer | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-07 18:53:57 +0000 |
commit | 83cb9e0a28d12f4c68e75dca6df33678f754e302 (patch) | |
tree | eed727623e48bdf4f07c3a9d4e07bae682c9491f /chrome/browser/webdata/web_data_service.cc | |
parent | 4bdd8e1ead1683e5ccba967d252c0ef50ff1d722 (diff) | |
download | chromium_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.cc | 16 |
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); } ////////////////////////////////////////////////////////////////////////////// |