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

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

Issue 545175: Add the ability to save and remove AutoFill profiles from the AutoFillDialog.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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/browser/webdata/web_database.h » ('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
===================================================================
--- chrome/browser/webdata/web_data_service.cc (revision 36778)
+++ chrome/browser/webdata/web_data_service.cc (working copy)
@@ -160,10 +160,10 @@
request));
}
-void WebDataService::RemoveAutoFillProfile(const AutoFillProfile& profile) {
- GenericRequest<AutoFillProfile>* request =
- new GenericRequest<AutoFillProfile>(
- this, GetNextRequestHandle(), NULL, profile);
+void WebDataService::RemoveAutoFillProfile(int profile_id) {
+ GenericRequest<int>* request =
+ new GenericRequest<int>(
+ this, GetNextRequestHandle(), NULL, profile_id);
RegisterRequest(request);
ScheduleTask(NewRunnableMethod(this,
&WebDataService::RemoveAutoFillProfileImpl,
@@ -183,6 +183,18 @@
return request->GetHandle();
}
+WebDataService::Handle WebDataService::GetAutoFillProfiles(
+ WebDataServiceConsumer* consumer) {
+ WebDataRequest* request =
+ new WebDataRequest(this, GetNextRequestHandle(), consumer);
+ RegisterRequest(request);
+ ScheduleTask(
+ NewRunnableMethod(this,
+ &WebDataService::GetAutoFillProfilesImpl,
+ request));
+ return request->GetHandle();
+}
+
void WebDataService::RequestCompleted(Handle h) {
pending_lock_.Acquire();
RequestMap::iterator i = pending_requests_.find(h);
@@ -472,10 +484,21 @@
return;
}
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(this, &WebDataService::NotifyDatabaseLoadedOnUIThread));
+
db_ = db;
db_->BeginTransaction();
}
+void WebDataService::NotifyDatabaseLoadedOnUIThread() {
+ // Notify that the database has been initialized.
+ NotificationService::current()->Notify(NotificationType::WEB_DATABASE_LOADED,
+ NotificationService::AllSources(),
+ NotificationService::NoDetails());
+}
+
void WebDataService::ShutdownDatabase() {
should_commit_ = false;
@@ -734,11 +757,11 @@
}
void WebDataService::RemoveAutoFillProfileImpl(
- GenericRequest<AutoFillProfile>* request) {
+ GenericRequest<int>* request) {
InitializeDatabaseIfNecessary();
if (db_ && !request->IsCancelled()) {
- const AutoFillProfile& profile = request->GetArgument();
- if (!db_->RemoveAutoFillProfile(profile))
+ int profile_id = request->GetArgument();
+ if (!db_->RemoveAutoFillProfile(profile_id))
NOTREACHED();
ScheduleCommit();
}
@@ -758,6 +781,18 @@
request->RequestComplete();
}
+void WebDataService::GetAutoFillProfilesImpl(WebDataRequest* request) {
+ InitializeDatabaseIfNecessary();
+ if (db_ && !request->IsCancelled()) {
+ std::vector<AutoFillProfile*> profiles;
+ db_->GetAutoFillProfiles(&profiles);
+ request->SetResult(
+ new WDResult<std::vector<AutoFillProfile*> >(AUTOFILL_PROFILES_RESULT,
+ profiles));
+ }
+ request->RequestComplete();
+}
+
////////////////////////////////////////////////////////////////////////////////
//
// Web Apps implementation.
« no previous file with comments | « chrome/browser/webdata/web_data_service.h ('k') | chrome/browser/webdata/web_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698