| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 autofill_data_->GetCountOfValuesContainedBetween( | 99 autofill_data_->GetCountOfValuesContainedBetween( |
| 100 base::Time(), base::Time::Max(), this); | 100 base::Time(), base::Time::Max(), this); |
| 101 PendingQuery query; | 101 PendingQuery query; |
| 102 query.result = result; | 102 query.result = result; |
| 103 query.completion = completion; | 103 query.completion = completion; |
| 104 result_map_[pending_query_handle] = query; | 104 result_map_[pending_query_handle] = query; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void AwFormDatabaseService::OnWebDataServiceRequestDone( | 107 void AwFormDatabaseService::OnWebDataServiceRequestDone( |
| 108 WebDataServiceBase::Handle h, | 108 WebDataServiceBase::Handle h, |
| 109 const WDTypedResult* result) { | 109 std::unique_ptr<WDTypedResult> result) { |
| 110 | |
| 111 DCHECK_CURRENTLY_ON(BrowserThread::DB); | 110 DCHECK_CURRENTLY_ON(BrowserThread::DB); |
| 112 bool has_form_data = false; | 111 bool has_form_data = false; |
| 113 if (result) { | 112 if (result) { |
| 114 DCHECK_EQ(AUTOFILL_VALUE_RESULT, result->GetType()); | 113 DCHECK_EQ(AUTOFILL_VALUE_RESULT, result->GetType()); |
| 115 const WDResult<int>* autofill_result = | 114 const WDResult<int>* autofill_result = |
| 116 static_cast<const WDResult<int>*>(result); | 115 static_cast<const WDResult<int>*>(result.get()); |
| 117 has_form_data = autofill_result->GetValue() > 0; | 116 has_form_data = autofill_result->GetValue() > 0; |
| 118 } | 117 } |
| 119 QueryMap::const_iterator it = result_map_.find(h); | 118 QueryMap::const_iterator it = result_map_.find(h); |
| 120 if (it == result_map_.end()) { | 119 if (it == result_map_.end()) { |
| 121 LOG(WARNING) << "Received unexpected callback from web data service"; | 120 LOG(WARNING) << "Received unexpected callback from web data service"; |
| 122 return; | 121 return; |
| 123 } | 122 } |
| 124 *(it->second.result) = has_form_data; | 123 *(it->second.result) = has_form_data; |
| 125 it->second.completion->Signal(); | 124 it->second.completion->Signal(); |
| 126 result_map_.erase(h); | 125 result_map_.erase(h); |
| 127 } | 126 } |
| 128 | 127 |
| 129 } // namespace android_webview | 128 } // namespace android_webview |
| OLD | NEW |