OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/thread.h" | 10 #include "base/thread.h" |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 const AutoFillProfile& profile = request->GetArgument(); | 1032 const AutoFillProfile& profile = request->GetArgument(); |
1033 | 1033 |
1034 // TODO(dhollowa): Remove labels. http://crbug.com/58813 | 1034 // TODO(dhollowa): Remove labels. http://crbug.com/58813 |
1035 // Send out old Label-based notification until sync can switch over to | 1035 // Send out old Label-based notification until sync can switch over to |
1036 // GUID-based notifications. | 1036 // GUID-based notifications. |
1037 // Only perform the update if the profile exists. It is currently | 1037 // Only perform the update if the profile exists. It is currently |
1038 // valid to try to update a missing profile. We simply drop the write and | 1038 // valid to try to update a missing profile. We simply drop the write and |
1039 // the caller will detect this on the next refresh. | 1039 // the caller will detect this on the next refresh. |
1040 AutoFillProfile* original_profile = NULL; | 1040 AutoFillProfile* original_profile = NULL; |
1041 if (!db_->GetAutoFillProfileForGUID(profile.guid(), &original_profile)) { | 1041 if (!db_->GetAutoFillProfileForGUID(profile.guid(), &original_profile)) { |
| 1042 request->RequestComplete(); |
1042 return; | 1043 return; |
1043 } | 1044 } |
1044 scoped_ptr<AutoFillProfile> scoped_profile(original_profile); | 1045 scoped_ptr<AutoFillProfile> scoped_profile(original_profile); |
1045 | 1046 |
1046 if (!db_->UpdateAutoFillProfile(profile)) { | 1047 if (!db_->UpdateAutoFillProfile(profile)) { |
1047 NOTREACHED(); | 1048 NOTREACHED(); |
1048 return; | 1049 return; |
1049 } | 1050 } |
1050 ScheduleCommit(); | 1051 ScheduleCommit(); |
1051 | 1052 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 void WebDataService::UpdateCreditCardGUIDImpl( | 1151 void WebDataService::UpdateCreditCardGUIDImpl( |
1151 GenericRequest<CreditCard>* request) { | 1152 GenericRequest<CreditCard>* request) { |
1152 InitializeDatabaseIfNecessary(); | 1153 InitializeDatabaseIfNecessary(); |
1153 if (db_ && !request->IsCancelled()) { | 1154 if (db_ && !request->IsCancelled()) { |
1154 const CreditCard& credit_card = request->GetArgument(); | 1155 const CreditCard& credit_card = request->GetArgument(); |
1155 | 1156 |
1156 // It is currently valid to try to update a missing profile. We simply drop | 1157 // It is currently valid to try to update a missing profile. We simply drop |
1157 // the write and the caller will detect this on the next refresh. | 1158 // the write and the caller will detect this on the next refresh. |
1158 CreditCard* original_credit_card = NULL; | 1159 CreditCard* original_credit_card = NULL; |
1159 if (!db_->GetCreditCardForGUID(credit_card.guid(), &original_credit_card)) { | 1160 if (!db_->GetCreditCardForGUID(credit_card.guid(), &original_credit_card)) { |
| 1161 request->RequestComplete(); |
1160 return; | 1162 return; |
1161 } | 1163 } |
1162 scoped_ptr<CreditCard> scoped_credit_card(original_credit_card); | 1164 scoped_ptr<CreditCard> scoped_credit_card(original_credit_card); |
1163 | 1165 |
1164 if (!db_->UpdateCreditCard(credit_card)) { | 1166 if (!db_->UpdateCreditCard(credit_card)) { |
1165 NOTREACHED(); | 1167 NOTREACHED(); |
1166 return; | 1168 return; |
1167 } | 1169 } |
1168 ScheduleCommit(); | 1170 ScheduleCommit(); |
1169 | 1171 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 return result_; | 1275 return result_; |
1274 } | 1276 } |
1275 | 1277 |
1276 void WebDataService::WebDataRequest::RequestComplete() { | 1278 void WebDataService::WebDataRequest::RequestComplete() { |
1277 WebDataService* s = service_; | 1279 WebDataService* s = service_; |
1278 Task* t = NewRunnableMethod(s, | 1280 Task* t = NewRunnableMethod(s, |
1279 &WebDataService::RequestCompleted, | 1281 &WebDataService::RequestCompleted, |
1280 handle_); | 1282 handle_); |
1281 message_loop_->PostTask(FROM_HERE, t); | 1283 message_loop_->PostTask(FROM_HERE, t); |
1282 } | 1284 } |
OLD | NEW |