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(); | |
1043 return; | 1042 return; |
1044 } | 1043 } |
1045 scoped_ptr<AutoFillProfile> scoped_profile(original_profile); | 1044 scoped_ptr<AutoFillProfile> scoped_profile(original_profile); |
1046 | 1045 |
1047 if (!db_->UpdateAutoFillProfile(profile)) { | 1046 if (!db_->UpdateAutoFillProfile(profile)) { |
1048 NOTREACHED(); | 1047 NOTREACHED(); |
1049 return; | 1048 return; |
1050 } | 1049 } |
1051 ScheduleCommit(); | 1050 ScheduleCommit(); |
1052 | 1051 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 void WebDataService::UpdateCreditCardGUIDImpl( | 1150 void WebDataService::UpdateCreditCardGUIDImpl( |
1152 GenericRequest<CreditCard>* request) { | 1151 GenericRequest<CreditCard>* request) { |
1153 InitializeDatabaseIfNecessary(); | 1152 InitializeDatabaseIfNecessary(); |
1154 if (db_ && !request->IsCancelled()) { | 1153 if (db_ && !request->IsCancelled()) { |
1155 const CreditCard& credit_card = request->GetArgument(); | 1154 const CreditCard& credit_card = request->GetArgument(); |
1156 | 1155 |
1157 // It is currently valid to try to update a missing profile. We simply drop | 1156 // It is currently valid to try to update a missing profile. We simply drop |
1158 // the write and the caller will detect this on the next refresh. | 1157 // the write and the caller will detect this on the next refresh. |
1159 CreditCard* original_credit_card = NULL; | 1158 CreditCard* original_credit_card = NULL; |
1160 if (!db_->GetCreditCardForGUID(credit_card.guid(), &original_credit_card)) { | 1159 if (!db_->GetCreditCardForGUID(credit_card.guid(), &original_credit_card)) { |
1161 request->RequestComplete(); | |
1162 return; | 1160 return; |
1163 } | 1161 } |
1164 scoped_ptr<CreditCard> scoped_credit_card(original_credit_card); | 1162 scoped_ptr<CreditCard> scoped_credit_card(original_credit_card); |
1165 | 1163 |
1166 if (!db_->UpdateCreditCard(credit_card)) { | 1164 if (!db_->UpdateCreditCard(credit_card)) { |
1167 NOTREACHED(); | 1165 NOTREACHED(); |
1168 return; | 1166 return; |
1169 } | 1167 } |
1170 ScheduleCommit(); | 1168 ScheduleCommit(); |
1171 | 1169 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 return result_; | 1273 return result_; |
1276 } | 1274 } |
1277 | 1275 |
1278 void WebDataService::WebDataRequest::RequestComplete() { | 1276 void WebDataService::WebDataRequest::RequestComplete() { |
1279 WebDataService* s = service_; | 1277 WebDataService* s = service_; |
1280 Task* t = NewRunnableMethod(s, | 1278 Task* t = NewRunnableMethod(s, |
1281 &WebDataService::RequestCompleted, | 1279 &WebDataService::RequestCompleted, |
1282 handle_); | 1280 handle_); |
1283 message_loop_->PostTask(FROM_HERE, t); | 1281 message_loop_->PostTask(FROM_HERE, t); |
1284 } | 1282 } |
OLD | NEW |