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

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

Issue 7967024: Profile shouldn't own PersonalDataManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addresses isherman #11 Created 9 years, 3 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
« no previous file with comments | « chrome/browser/webdata/web_data_service.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/web_data_service.cc
diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc
index 1f6e6ce89490fc0131686beab5f55897c2a0041a..ece623007e2c864fd401e85d483f6314c9d31f10 100644
--- a/chrome/browser/webdata/web_data_service.cc
+++ b/chrome/browser/webdata/web_data_service.cc
@@ -10,6 +10,7 @@
#include "base/threading/thread.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/autofill/credit_card.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/ui/profile_error_dialog.h"
#include "chrome/browser/webdata/autofill_change.h"
@@ -42,6 +43,36 @@ using base::Time;
using webkit_glue::FormField;
using webkit_glue::PasswordForm;
+namespace {
+// A task used by WebDataService (for Sync mainly) to inform the
+// PersonalDataManager living on the UI thread that it needs to refresh.
+class NotifyOfMultipleAutofillChangesTask : public Task {
+ public:
+ explicit NotifyOfMultipleAutofillChangesTask(
+ WebDataService* web_data_service);
+ virtual ~NotifyOfMultipleAutofillChangesTask();
+ virtual void Run();
+ private:
+ WebDataService* web_data_service_;
+};
+
+NotifyOfMultipleAutofillChangesTask::NotifyOfMultipleAutofillChangesTask(
+ WebDataService* web_data_service) : web_data_service_(web_data_service) {
+}
+
+NotifyOfMultipleAutofillChangesTask::~NotifyOfMultipleAutofillChangesTask() {}
+
+void NotifyOfMultipleAutofillChangesTask::Run() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ NotificationService::current()->Notify(
+ chrome::NOTIFICATION_AUTOFILL_MULTIPLE_CHANGED,
+ Source<WebDataService>(web_data_service_),
+ NotificationService::NoDetails());
+}
+
+} // namespace
+
WDAppImagesResult::WDAppImagesResult() : has_all_images(false) {}
WDAppImagesResult::~WDAppImagesResult() {}
@@ -62,6 +93,22 @@ WebDataService::WebDataService()
main_loop_(MessageLoop::current()) {
}
+// static
+void WebDataService::NotifyOfMultipleAutofillChanges(Profile* profile) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
+
+ if (!profile)
+ return;
+
+ WebDataService* web_data_service =
+ profile->GetWebDataService(Profile::EXPLICIT_ACCESS);
+ if (!web_data_service)
+ return;
+
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ new NotifyOfMultipleAutofillChangesTask(web_data_service));
+}
+
bool WebDataService::Init(const FilePath& profile_path) {
FilePath path = profile_path;
path = path.Append(chrome::kWebDataFilename);
« no previous file with comments | « chrome/browser/webdata/web_data_service.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698