OLD | NEW |
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" |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 } | 941 } |
942 | 942 |
943 void WebDataService::RemoveFormElementsAddedBetweenImpl( | 943 void WebDataService::RemoveFormElementsAddedBetweenImpl( |
944 GenericRequest2<Time, Time>* request) { | 944 GenericRequest2<Time, Time>* request) { |
945 InitializeDatabaseIfNecessary(); | 945 InitializeDatabaseIfNecessary(); |
946 if (db_ && !request->IsCancelled()) { | 946 if (db_ && !request->IsCancelled()) { |
947 AutofillChangeList changes; | 947 AutofillChangeList changes; |
948 if (db_->RemoveFormElementsAddedBetween(request->GetArgument1(), | 948 if (db_->RemoveFormElementsAddedBetween(request->GetArgument1(), |
949 request->GetArgument2(), | 949 request->GetArgument2(), |
950 &changes)) { | 950 &changes)) { |
951 if (changes.size() > 0) { | 951 if (!changes.empty()) { |
952 request->SetResult( | 952 request->SetResult( |
953 new WDResult<AutofillChangeList>(AUTOFILL_CHANGES, changes)); | 953 new WDResult<AutofillChangeList>(AUTOFILL_CHANGES, changes)); |
954 | 954 |
955 // Post the notifications including the list of affected keys. | 955 // Post the notifications including the list of affected keys. |
956 // This is sent here so that work resulting from this notification | 956 // This is sent here so that work resulting from this notification |
957 // will be done on the DB thread, and not the UI thread. | 957 // will be done on the DB thread, and not the UI thread. |
958 NotificationService::current()->Notify( | 958 NotificationService::current()->Notify( |
959 NotificationType::AUTOFILL_ENTRIES_CHANGED, | 959 NotificationType::AUTOFILL_ENTRIES_CHANGED, |
960 Source<WebDataService>(this), | 960 Source<WebDataService>(this), |
961 Details<AutofillChangeList>(&changes)); | 961 Details<AutofillChangeList>(&changes)); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 return result_; | 1236 return result_; |
1237 } | 1237 } |
1238 | 1238 |
1239 void WebDataService::WebDataRequest::RequestComplete() { | 1239 void WebDataService::WebDataRequest::RequestComplete() { |
1240 WebDataService* s = service_; | 1240 WebDataService* s = service_; |
1241 Task* t = NewRunnableMethod(s, | 1241 Task* t = NewRunnableMethod(s, |
1242 &WebDataService::RequestCompleted, | 1242 &WebDataService::RequestCompleted, |
1243 handle_); | 1243 handle_); |
1244 message_loop_->PostTask(FROM_HERE, t); | 1244 message_loop_->PostTask(FROM_HERE, t); |
1245 } | 1245 } |
OLD | NEW |