| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "android_webview/browser/aw_form_database_service.h" | 5 #include "android_webview/browser/aw_form_database_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "components/autofill/core/browser/webdata/autofill_table.h" | 10 #include "components/autofill/core/browser/webdata/autofill_table.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 void AwFormDatabaseService::ClearFormDataImpl() { | 72 void AwFormDatabaseService::ClearFormDataImpl() { |
| 73 base::Time begin; | 73 base::Time begin; |
| 74 base::Time end = base::Time::Max(); | 74 base::Time end = base::Time::Max(); |
| 75 autofill_data_->RemoveFormElementsAddedBetween(begin, end); | 75 autofill_data_->RemoveFormElementsAddedBetween(begin, end); |
| 76 autofill_data_->RemoveAutofillDataModifiedBetween(begin, end); | 76 autofill_data_->RemoveAutofillDataModifiedBetween(begin, end); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool AwFormDatabaseService::HasFormData() { | 79 bool AwFormDatabaseService::HasFormData() { |
| 80 WaitableEvent completion(false, false); | 80 WaitableEvent completion(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 81 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 81 bool result = false; | 82 bool result = false; |
| 82 BrowserThread::PostTask( | 83 BrowserThread::PostTask( |
| 83 BrowserThread::DB, | 84 BrowserThread::DB, |
| 84 FROM_HERE, | 85 FROM_HERE, |
| 85 base::Bind(&AwFormDatabaseService::HasFormDataImpl, | 86 base::Bind(&AwFormDatabaseService::HasFormDataImpl, |
| 86 base::Unretained(this), | 87 base::Unretained(this), |
| 87 &completion, | 88 &completion, |
| 88 &result)); | 89 &result)); |
| 89 completion.Wait(); | 90 completion.Wait(); |
| 90 return result; | 91 return result; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 118 if (it == result_map_.end()) { | 119 if (it == result_map_.end()) { |
| 119 LOG(WARNING) << "Received unexpected callback from web data service"; | 120 LOG(WARNING) << "Received unexpected callback from web data service"; |
| 120 return; | 121 return; |
| 121 } | 122 } |
| 122 *(it->second.result) = has_form_data; | 123 *(it->second.result) = has_form_data; |
| 123 it->second.completion->Signal(); | 124 it->second.completion->Signal(); |
| 124 result_map_.erase(h); | 125 result_map_.erase(h); |
| 125 } | 126 } |
| 126 | 127 |
| 127 } // namespace android_webview | 128 } // namespace android_webview |
| OLD | NEW |