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

Side by Side Diff: chrome/browser/webdata/web_data_service.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/webdata/web_data_service.h" 5 #include "chrome/browser/webdata/web_data_service.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "chrome/browser/autofill/autofill_profile.h" 11 #include "chrome/browser/autofill/autofill_profile.h"
12 #include "chrome/browser/autofill/credit_card.h" 12 #include "chrome/browser/autofill/credit_card.h"
13 #include "chrome/browser/search_engines/template_url.h" 13 #include "chrome/browser/search_engines/template_url.h"
14 #include "chrome/browser/ui/profile_error_dialog.h" 14 #include "chrome/browser/ui/profile_error_dialog.h"
15 #include "chrome/browser/webdata/autofill_change.h" 15 #include "chrome/browser/webdata/autofill_change.h"
16 #include "chrome/browser/webdata/autofill_entry.h" 16 #include "chrome/browser/webdata/autofill_entry.h"
17 #include "chrome/browser/webdata/web_database.h" 17 #include "chrome/browser/webdata/web_database.h"
18 #include "chrome/common/chrome_constants.h" 18 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/chrome_notification_types.h"
19 #include "content/common/notification_details.h" 20 #include "content/common/notification_details.h"
20 #include "content/common/notification_service.h" 21 #include "content/common/notification_service.h"
21 #include "content/common/notification_source.h" 22 #include "content/common/notification_source.h"
22 #include "content/common/notification_type.h"
23 #include "grit/chromium_strings.h" 23 #include "grit/chromium_strings.h"
24 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
25 #include "third_party/skia/include/core/SkBitmap.h" 25 #include "third_party/skia/include/core/SkBitmap.h"
26 #include "webkit/glue/form_field.h" 26 #include "webkit/glue/form_field.h"
27 #include "webkit/glue/password_form.h" 27 #include "webkit/glue/password_form.h"
28 28
29 //////////////////////////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////////////////////////
30 // 30 //
31 // WebDataService implementation. 31 // WebDataService implementation.
32 // 32 //
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 BrowserThread::PostTask( 599 BrowserThread::PostTask(
600 BrowserThread::UI, FROM_HERE, 600 BrowserThread::UI, FROM_HERE,
601 NewRunnableMethod(this, &WebDataService::NotifyDatabaseLoadedOnUIThread)); 601 NewRunnableMethod(this, &WebDataService::NotifyDatabaseLoadedOnUIThread));
602 602
603 db_ = db; 603 db_ = db;
604 db_->BeginTransaction(); 604 db_->BeginTransaction();
605 } 605 }
606 606
607 void WebDataService::NotifyDatabaseLoadedOnUIThread() { 607 void WebDataService::NotifyDatabaseLoadedOnUIThread() {
608 // Notify that the database has been initialized. 608 // Notify that the database has been initialized.
609 NotificationService::current()->Notify(NotificationType::WEB_DATABASE_LOADED, 609 NotificationService::current()->Notify(
610 Source<WebDataService>(this), 610 chrome::NOTIFICATION_WEB_DATABASE_LOADED, Source<WebDataService>(this),
611 NotificationService::NoDetails()); 611 NotificationService::NoDetails());
612 } 612 }
613 613
614 void WebDataService::ShutdownDatabase() { 614 void WebDataService::ShutdownDatabase() {
615 should_commit_ = false; 615 should_commit_ = false;
616 616
617 if (db_) { 617 if (db_) {
618 db_->CommitTransaction(); 618 db_->CommitTransaction();
619 delete db_; 619 delete db_;
620 db_ = NULL; 620 db_ = NULL;
621 } 621 }
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 return; 928 return;
929 } 929 }
930 request->SetResult( 930 request->SetResult(
931 new WDResult<AutofillChangeList>(AUTOFILL_CHANGES, changes)); 931 new WDResult<AutofillChangeList>(AUTOFILL_CHANGES, changes));
932 ScheduleCommit(); 932 ScheduleCommit();
933 933
934 // Post the notifications including the list of affected keys. 934 // Post the notifications including the list of affected keys.
935 // This is sent here so that work resulting from this notification will be 935 // This is sent here so that work resulting from this notification will be
936 // done on the DB thread, and not the UI thread. 936 // done on the DB thread, and not the UI thread.
937 NotificationService::current()->Notify( 937 NotificationService::current()->Notify(
938 NotificationType::AUTOFILL_ENTRIES_CHANGED, 938 chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
939 Source<WebDataService>(this), 939 Source<WebDataService>(this),
940 Details<AutofillChangeList>(&changes)); 940 Details<AutofillChangeList>(&changes));
941 } 941 }
942 942
943 request->RequestComplete(); 943 request->RequestComplete();
944 } 944 }
945 945
946 void WebDataService::GetFormValuesForElementNameImpl(WebDataRequest* request, 946 void WebDataService::GetFormValuesForElementNameImpl(WebDataRequest* request,
947 const string16& name, const string16& prefix, int limit) { 947 const string16& name, const string16& prefix, int limit) {
948 InitializeDatabaseIfNecessary(); 948 InitializeDatabaseIfNecessary();
(...skipping 15 matching lines...) Expand all
964 if (db_->GetAutofillTable()->RemoveFormElementsAddedBetween( 964 if (db_->GetAutofillTable()->RemoveFormElementsAddedBetween(
965 request->arg1(), request->arg2(), &changes)) { 965 request->arg1(), request->arg2(), &changes)) {
966 if (!changes.empty()) { 966 if (!changes.empty()) {
967 request->SetResult( 967 request->SetResult(
968 new WDResult<AutofillChangeList>(AUTOFILL_CHANGES, changes)); 968 new WDResult<AutofillChangeList>(AUTOFILL_CHANGES, changes));
969 969
970 // Post the notifications including the list of affected keys. 970 // Post the notifications including the list of affected keys.
971 // This is sent here so that work resulting from this notification 971 // This is sent here so that work resulting from this notification
972 // will be done on the DB thread, and not the UI thread. 972 // will be done on the DB thread, and not the UI thread.
973 NotificationService::current()->Notify( 973 NotificationService::current()->Notify(
974 NotificationType::AUTOFILL_ENTRIES_CHANGED, 974 chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
975 Source<WebDataService>(this), 975 Source<WebDataService>(this),
976 Details<AutofillChangeList>(&changes)); 976 Details<AutofillChangeList>(&changes));
977 } 977 }
978 ScheduleCommit(); 978 ScheduleCommit();
979 } 979 }
980 } 980 }
981 request->RequestComplete(); 981 request->RequestComplete();
982 } 982 }
983 983
984 void WebDataService::RemoveFormValueForElementNameImpl( 984 void WebDataService::RemoveFormValueForElementNameImpl(
985 GenericRequest2<string16, string16>* request) { 985 GenericRequest2<string16, string16>* request) {
986 InitializeDatabaseIfNecessary(); 986 InitializeDatabaseIfNecessary();
987 if (db_ && !request->IsCancelled()) { 987 if (db_ && !request->IsCancelled()) {
988 const string16& name = request->arg1(); 988 const string16& name = request->arg1();
989 const string16& value = request->arg2(); 989 const string16& value = request->arg2();
990 990
991 if (db_->GetAutofillTable()->RemoveFormElement(name, value)) { 991 if (db_->GetAutofillTable()->RemoveFormElement(name, value)) {
992 AutofillChangeList changes; 992 AutofillChangeList changes;
993 changes.push_back(AutofillChange(AutofillChange::REMOVE, 993 changes.push_back(AutofillChange(AutofillChange::REMOVE,
994 AutofillKey(name, value))); 994 AutofillKey(name, value)));
995 request->SetResult( 995 request->SetResult(
996 new WDResult<AutofillChangeList>(AUTOFILL_CHANGES, changes)); 996 new WDResult<AutofillChangeList>(AUTOFILL_CHANGES, changes));
997 ScheduleCommit(); 997 ScheduleCommit();
998 998
999 // Post the notifications including the list of affected keys. 999 // Post the notifications including the list of affected keys.
1000 NotificationService::current()->Notify( 1000 NotificationService::current()->Notify(
1001 NotificationType::AUTOFILL_ENTRIES_CHANGED, 1001 chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
1002 Source<WebDataService>(this), 1002 Source<WebDataService>(this),
1003 Details<AutofillChangeList>(&changes)); 1003 Details<AutofillChangeList>(&changes));
1004 } 1004 }
1005 } 1005 }
1006 request->RequestComplete(); 1006 request->RequestComplete();
1007 } 1007 }
1008 1008
1009 void WebDataService::AddAutofillProfileImpl( 1009 void WebDataService::AddAutofillProfileImpl(
1010 GenericRequest<AutofillProfile>* request) { 1010 GenericRequest<AutofillProfile>* request) {
1011 InitializeDatabaseIfNecessary(); 1011 InitializeDatabaseIfNecessary();
1012 if (db_ && !request->IsCancelled()) { 1012 if (db_ && !request->IsCancelled()) {
1013 const AutofillProfile& profile = request->arg(); 1013 const AutofillProfile& profile = request->arg();
1014 if (!db_->GetAutofillTable()->AddAutofillProfile(profile)) { 1014 if (!db_->GetAutofillTable()->AddAutofillProfile(profile)) {
1015 NOTREACHED(); 1015 NOTREACHED();
1016 return; 1016 return;
1017 } 1017 }
1018 ScheduleCommit(); 1018 ScheduleCommit();
1019 1019
1020 // Send GUID-based notification. 1020 // Send GUID-based notification.
1021 AutofillProfileChange change(AutofillProfileChange::ADD, 1021 AutofillProfileChange change(AutofillProfileChange::ADD,
1022 profile.guid(), &profile); 1022 profile.guid(), &profile);
1023 NotificationService::current()->Notify( 1023 NotificationService::current()->Notify(
1024 NotificationType::AUTOFILL_PROFILE_CHANGED, 1024 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
1025 Source<WebDataService>(this), 1025 Source<WebDataService>(this),
1026 Details<AutofillProfileChange>(&change)); 1026 Details<AutofillProfileChange>(&change));
1027 } 1027 }
1028 request->RequestComplete(); 1028 request->RequestComplete();
1029 } 1029 }
1030 1030
1031 void WebDataService::UpdateAutofillProfileImpl( 1031 void WebDataService::UpdateAutofillProfileImpl(
1032 GenericRequest<AutofillProfile>* request) { 1032 GenericRequest<AutofillProfile>* request) {
1033 InitializeDatabaseIfNecessary(); 1033 InitializeDatabaseIfNecessary();
1034 if (db_ && !request->IsCancelled()) { 1034 if (db_ && !request->IsCancelled()) {
(...skipping 13 matching lines...) Expand all
1048 if (!db_->GetAutofillTable()->UpdateAutofillProfileMulti(profile)) { 1048 if (!db_->GetAutofillTable()->UpdateAutofillProfileMulti(profile)) {
1049 NOTREACHED(); 1049 NOTREACHED();
1050 return; 1050 return;
1051 } 1051 }
1052 ScheduleCommit(); 1052 ScheduleCommit();
1053 1053
1054 // Send GUID-based notification. 1054 // Send GUID-based notification.
1055 AutofillProfileChange change(AutofillProfileChange::UPDATE, 1055 AutofillProfileChange change(AutofillProfileChange::UPDATE,
1056 profile.guid(), &profile); 1056 profile.guid(), &profile);
1057 NotificationService::current()->Notify( 1057 NotificationService::current()->Notify(
1058 NotificationType::AUTOFILL_PROFILE_CHANGED, 1058 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
1059 Source<WebDataService>(this), 1059 Source<WebDataService>(this),
1060 Details<AutofillProfileChange>(&change)); 1060 Details<AutofillProfileChange>(&change));
1061 } 1061 }
1062 request->RequestComplete(); 1062 request->RequestComplete();
1063 } 1063 }
1064 1064
1065 void WebDataService::RemoveAutofillProfileImpl( 1065 void WebDataService::RemoveAutofillProfileImpl(
1066 GenericRequest<std::string>* request) { 1066 GenericRequest<std::string>* request) {
1067 InitializeDatabaseIfNecessary(); 1067 InitializeDatabaseIfNecessary();
1068 if (db_ && !request->IsCancelled()) { 1068 if (db_ && !request->IsCancelled()) {
1069 const std::string& guid = request->arg(); 1069 const std::string& guid = request->arg();
1070 1070
1071 AutofillProfile* profile = NULL; 1071 AutofillProfile* profile = NULL;
1072 if (!db_->GetAutofillTable()->GetAutofillProfile(guid, &profile)) { 1072 if (!db_->GetAutofillTable()->GetAutofillProfile(guid, &profile)) {
1073 NOTREACHED(); 1073 NOTREACHED();
1074 return; 1074 return;
1075 } 1075 }
1076 scoped_ptr<AutofillProfile> scoped_profile(profile); 1076 scoped_ptr<AutofillProfile> scoped_profile(profile);
1077 1077
1078 if (!db_->GetAutofillTable()->RemoveAutofillProfile(guid)) { 1078 if (!db_->GetAutofillTable()->RemoveAutofillProfile(guid)) {
1079 NOTREACHED(); 1079 NOTREACHED();
1080 return; 1080 return;
1081 } 1081 }
1082 ScheduleCommit(); 1082 ScheduleCommit();
1083 1083
1084 // Send GUID-based notification. 1084 // Send GUID-based notification.
1085 AutofillProfileChange change(AutofillProfileChange::REMOVE, guid, NULL); 1085 AutofillProfileChange change(AutofillProfileChange::REMOVE, guid, NULL);
1086 NotificationService::current()->Notify( 1086 NotificationService::current()->Notify(
1087 NotificationType::AUTOFILL_PROFILE_CHANGED, 1087 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
1088 Source<WebDataService>(this), 1088 Source<WebDataService>(this),
1089 Details<AutofillProfileChange>(&change)); 1089 Details<AutofillProfileChange>(&change));
1090 } 1090 }
1091 request->RequestComplete(); 1091 request->RequestComplete();
1092 } 1092 }
1093 1093
1094 void WebDataService::GetAutofillProfilesImpl(WebDataRequest* request) { 1094 void WebDataService::GetAutofillProfilesImpl(WebDataRequest* request) {
1095 InitializeDatabaseIfNecessary(); 1095 InitializeDatabaseIfNecessary();
1096 if (db_ && !request->IsCancelled()) { 1096 if (db_ && !request->IsCancelled()) {
1097 std::vector<AutofillProfile*> profiles; 1097 std::vector<AutofillProfile*> profiles;
(...skipping 16 matching lines...) Expand all
1114 NOTREACHED(); 1114 NOTREACHED();
1115 return; 1115 return;
1116 } 1116 }
1117 1117
1118 for (std::vector<std::string>::const_iterator iter = guids.begin(); 1118 for (std::vector<std::string>::const_iterator iter = guids.begin();
1119 iter != guids.end(); ++iter) { 1119 iter != guids.end(); ++iter) {
1120 // Send GUID-based notification. 1120 // Send GUID-based notification.
1121 AutofillProfileChange change(AutofillProfileChange::REMOVE, 1121 AutofillProfileChange change(AutofillProfileChange::REMOVE,
1122 *iter, NULL); 1122 *iter, NULL);
1123 NotificationService::current()->Notify( 1123 NotificationService::current()->Notify(
1124 NotificationType::AUTOFILL_PROFILE_CHANGED, 1124 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
1125 Source<WebDataService>(this), 1125 Source<WebDataService>(this),
1126 Details<AutofillProfileChange>(&change)); 1126 Details<AutofillProfileChange>(&change));
1127 } 1127 }
1128 1128
1129 // If we trashed any profiles they may have been merged, so send out 1129 // If we trashed any profiles they may have been merged, so send out
1130 // update notifications as well. 1130 // update notifications as well.
1131 if (!guids.empty()) { 1131 if (!guids.empty()) {
1132 std::vector<AutofillProfile*> profiles; 1132 std::vector<AutofillProfile*> profiles;
1133 db_->GetAutofillTable()->GetAutofillProfiles(&profiles); 1133 db_->GetAutofillTable()->GetAutofillProfiles(&profiles);
1134 for (std::vector<AutofillProfile*>::const_iterator 1134 for (std::vector<AutofillProfile*>::const_iterator
1135 iter = profiles.begin(); 1135 iter = profiles.begin();
1136 iter != profiles.end(); ++iter) { 1136 iter != profiles.end(); ++iter) {
1137 AutofillProfileChange change(AutofillProfileChange::UPDATE, 1137 AutofillProfileChange change(AutofillProfileChange::UPDATE,
1138 (*iter)->guid(), *iter); 1138 (*iter)->guid(), *iter);
1139 NotificationService::current()->Notify( 1139 NotificationService::current()->Notify(
1140 NotificationType::AUTOFILL_PROFILE_CHANGED, 1140 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
1141 Source<WebDataService>(this), 1141 Source<WebDataService>(this),
1142 Details<AutofillProfileChange>(&change)); 1142 Details<AutofillProfileChange>(&change));
1143 } 1143 }
1144 STLDeleteElements(&profiles); 1144 STLDeleteElements(&profiles);
1145 } 1145 }
1146 } 1146 }
1147 1147
1148 if (!db_->GetAutofillTable()->EmptyAutofillProfilesTrash()) { 1148 if (!db_->GetAutofillTable()->EmptyAutofillProfilesTrash()) {
1149 NOTREACHED(); 1149 NOTREACHED();
1150 return; 1150 return;
(...skipping 11 matching lines...) Expand all
1162 if (!db_->GetAutofillTable()->AddCreditCard(credit_card)) { 1162 if (!db_->GetAutofillTable()->AddCreditCard(credit_card)) {
1163 NOTREACHED(); 1163 NOTREACHED();
1164 return; 1164 return;
1165 } 1165 }
1166 ScheduleCommit(); 1166 ScheduleCommit();
1167 1167
1168 // Send GUID-based notification. 1168 // Send GUID-based notification.
1169 AutofillCreditCardChange change(AutofillCreditCardChange::ADD, 1169 AutofillCreditCardChange change(AutofillCreditCardChange::ADD,
1170 credit_card.guid(), &credit_card); 1170 credit_card.guid(), &credit_card);
1171 NotificationService::current()->Notify( 1171 NotificationService::current()->Notify(
1172 NotificationType::AUTOFILL_CREDIT_CARD_CHANGED, 1172 chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED,
1173 Source<WebDataService>(this), 1173 Source<WebDataService>(this),
1174 Details<AutofillCreditCardChange>(&change)); 1174 Details<AutofillCreditCardChange>(&change));
1175 } 1175 }
1176 request->RequestComplete(); 1176 request->RequestComplete();
1177 } 1177 }
1178 1178
1179 void WebDataService::UpdateCreditCardImpl( 1179 void WebDataService::UpdateCreditCardImpl(
1180 GenericRequest<CreditCard>* request) { 1180 GenericRequest<CreditCard>* request) {
1181 InitializeDatabaseIfNecessary(); 1181 InitializeDatabaseIfNecessary();
1182 if (db_ && !request->IsCancelled()) { 1182 if (db_ && !request->IsCancelled()) {
(...skipping 12 matching lines...) Expand all
1195 if (!db_->GetAutofillTable()->UpdateCreditCard(credit_card)) { 1195 if (!db_->GetAutofillTable()->UpdateCreditCard(credit_card)) {
1196 NOTREACHED(); 1196 NOTREACHED();
1197 return; 1197 return;
1198 } 1198 }
1199 ScheduleCommit(); 1199 ScheduleCommit();
1200 1200
1201 // Send GUID-based notification. 1201 // Send GUID-based notification.
1202 AutofillCreditCardChange change(AutofillCreditCardChange::UPDATE, 1202 AutofillCreditCardChange change(AutofillCreditCardChange::UPDATE,
1203 credit_card.guid(), &credit_card); 1203 credit_card.guid(), &credit_card);
1204 NotificationService::current()->Notify( 1204 NotificationService::current()->Notify(
1205 NotificationType::AUTOFILL_CREDIT_CARD_CHANGED, 1205 chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED,
1206 Source<WebDataService>(this), 1206 Source<WebDataService>(this),
1207 Details<AutofillCreditCardChange>(&change)); 1207 Details<AutofillCreditCardChange>(&change));
1208 } 1208 }
1209 request->RequestComplete(); 1209 request->RequestComplete();
1210 } 1210 }
1211 1211
1212 void WebDataService::RemoveCreditCardImpl( 1212 void WebDataService::RemoveCreditCardImpl(
1213 GenericRequest<std::string>* request) { 1213 GenericRequest<std::string>* request) {
1214 InitializeDatabaseIfNecessary(); 1214 InitializeDatabaseIfNecessary();
1215 if (db_ && !request->IsCancelled()) { 1215 if (db_ && !request->IsCancelled()) {
1216 const std::string& guid = request->arg(); 1216 const std::string& guid = request->arg();
1217 if (!db_->GetAutofillTable()->RemoveCreditCard(guid)) { 1217 if (!db_->GetAutofillTable()->RemoveCreditCard(guid)) {
1218 NOTREACHED(); 1218 NOTREACHED();
1219 return; 1219 return;
1220 } 1220 }
1221 ScheduleCommit(); 1221 ScheduleCommit();
1222 1222
1223 // Send GUID-based notification. 1223 // Send GUID-based notification.
1224 AutofillCreditCardChange change(AutofillCreditCardChange::REMOVE, guid, 1224 AutofillCreditCardChange change(AutofillCreditCardChange::REMOVE, guid,
1225 NULL); 1225 NULL);
1226 NotificationService::current()->Notify( 1226 NotificationService::current()->Notify(
1227 NotificationType::AUTOFILL_CREDIT_CARD_CHANGED, 1227 chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED,
1228 Source<WebDataService>(this), 1228 Source<WebDataService>(this),
1229 Details<AutofillCreditCardChange>(&change)); 1229 Details<AutofillCreditCardChange>(&change));
1230 } 1230 }
1231 request->RequestComplete(); 1231 request->RequestComplete();
1232 } 1232 }
1233 1233
1234 void WebDataService::GetCreditCardsImpl(WebDataRequest* request) { 1234 void WebDataService::GetCreditCardsImpl(WebDataRequest* request) {
1235 InitializeDatabaseIfNecessary(); 1235 InitializeDatabaseIfNecessary();
1236 if (db_ && !request->IsCancelled()) { 1236 if (db_ && !request->IsCancelled()) {
1237 std::vector<CreditCard*> credit_cards; 1237 std::vector<CreditCard*> credit_cards;
(...skipping 15 matching lines...) Expand all
1253 RemoveAutofillProfilesAndCreditCardsModifiedBetween( 1253 RemoveAutofillProfilesAndCreditCardsModifiedBetween(
1254 request->arg1(), 1254 request->arg1(),
1255 request->arg2(), 1255 request->arg2(),
1256 &profile_guids, 1256 &profile_guids,
1257 &credit_card_guids)) { 1257 &credit_card_guids)) {
1258 for (std::vector<std::string>::iterator iter = profile_guids.begin(); 1258 for (std::vector<std::string>::iterator iter = profile_guids.begin();
1259 iter != profile_guids.end(); ++iter) { 1259 iter != profile_guids.end(); ++iter) {
1260 AutofillProfileChange change(AutofillProfileChange::REMOVE, *iter, 1260 AutofillProfileChange change(AutofillProfileChange::REMOVE, *iter,
1261 NULL); 1261 NULL);
1262 NotificationService::current()->Notify( 1262 NotificationService::current()->Notify(
1263 NotificationType::AUTOFILL_PROFILE_CHANGED, 1263 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
1264 Source<WebDataService>(this), 1264 Source<WebDataService>(this),
1265 Details<AutofillProfileChange>(&change)); 1265 Details<AutofillProfileChange>(&change));
1266 } 1266 }
1267 1267
1268 for (std::vector<std::string>::iterator iter = credit_card_guids.begin(); 1268 for (std::vector<std::string>::iterator iter = credit_card_guids.begin();
1269 iter != credit_card_guids.end(); ++iter) { 1269 iter != credit_card_guids.end(); ++iter) {
1270 AutofillCreditCardChange change(AutofillCreditCardChange::REMOVE, 1270 AutofillCreditCardChange change(AutofillCreditCardChange::REMOVE,
1271 *iter, NULL); 1271 *iter, NULL);
1272 NotificationService::current()->Notify( 1272 NotificationService::current()->Notify(
1273 NotificationType::AUTOFILL_CREDIT_CARD_CHANGED, 1273 chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED,
1274 Source<WebDataService>(this), 1274 Source<WebDataService>(this),
1275 Details<AutofillCreditCardChange>(&change)); 1275 Details<AutofillCreditCardChange>(&change));
1276 } 1276 }
1277 // Note: It is the caller's responsibility to post notifications for any 1277 // Note: It is the caller's responsibility to post notifications for any
1278 // changes, e.g. by calling the Refresh() method of PersonalDataManager. 1278 // changes, e.g. by calling the Refresh() method of PersonalDataManager.
1279 ScheduleCommit(); 1279 ScheduleCommit();
1280 } 1280 }
1281 } 1281 }
1282 request->RequestComplete(); 1282 request->RequestComplete();
1283 } 1283 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 return result_; 1328 return result_;
1329 } 1329 }
1330 1330
1331 void WebDataService::WebDataRequest::RequestComplete() { 1331 void WebDataService::WebDataRequest::RequestComplete() {
1332 WebDataService* s = service_; 1332 WebDataService* s = service_;
1333 Task* t = NewRunnableMethod(s, 1333 Task* t = NewRunnableMethod(s,
1334 &WebDataService::RequestCompleted, 1334 &WebDataService::RequestCompleted,
1335 handle_); 1335 handle_);
1336 message_loop_->PostTask(FROM_HERE, t); 1336 message_loop_->PostTask(FROM_HERE, t);
1337 } 1337 }
OLDNEW
« no previous file with comments | « chrome/browser/web_resource/web_resource_service.cc ('k') | chrome/browser/webdata/web_data_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698