OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/autofill/core/browser/autocomplete_history_manager.h" | 5 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 suggestions.push_back(Suggestion(result)); | 133 suggestions.push_back(Suggestion(result)); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 external_delegate_->OnSuggestionsReturned(query_id_, suggestions); | 137 external_delegate_->OnSuggestionsReturned(query_id_, suggestions); |
138 query_id_ = 0; | 138 query_id_ = 0; |
139 } | 139 } |
140 | 140 |
141 void AutocompleteHistoryManager::OnWebDataServiceRequestDone( | 141 void AutocompleteHistoryManager::OnWebDataServiceRequestDone( |
142 WebDataServiceBase::Handle h, | 142 WebDataServiceBase::Handle h, |
143 const WDTypedResult* result) { | 143 std::unique_ptr<WDTypedResult> result) { |
144 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is | 144 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
145 // fixed. | 145 // fixed. |
146 tracked_objects::ScopedTracker tracking_profile( | 146 tracked_objects::ScopedTracker tracking_profile( |
147 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 147 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
148 "422460 AutocompleteHistoryManager::OnWebDataServiceRequestDone")); | 148 "422460 AutocompleteHistoryManager::OnWebDataServiceRequestDone")); |
149 | 149 |
150 DCHECK(pending_query_handle_); | 150 DCHECK(pending_query_handle_); |
151 pending_query_handle_ = 0; | 151 pending_query_handle_ = 0; |
152 | 152 |
153 DCHECK(result); | 153 DCHECK(result); |
154 // Returning early here if |result| is NULL. We've seen this happen on | 154 // Returning early here if |result| is NULL. We've seen this happen on |
155 // Linux due to NFS dismounting and causing sql failures. | 155 // Linux due to NFS dismounting and causing sql failures. |
156 // See http://crbug.com/68783. | 156 // See http://crbug.com/68783. |
157 if (!result) { | 157 if (!result) { |
158 SendSuggestions(NULL); | 158 SendSuggestions(NULL); |
159 return; | 159 return; |
160 } | 160 } |
161 | 161 |
162 DCHECK_EQ(AUTOFILL_VALUE_RESULT, result->GetType()); | 162 DCHECK_EQ(AUTOFILL_VALUE_RESULT, result->GetType()); |
163 const WDResult<std::vector<base::string16> >* autofill_result = | 163 const WDResult<std::vector<base::string16>>* autofill_result = |
164 static_cast<const WDResult<std::vector<base::string16> >*>(result); | 164 static_cast<const WDResult<std::vector<base::string16>>*>(result.get()); |
165 std::vector<base::string16> suggestions = autofill_result->GetValue(); | 165 std::vector<base::string16> suggestions = autofill_result->GetValue(); |
166 SendSuggestions(&suggestions); | 166 SendSuggestions(&suggestions); |
167 } | 167 } |
168 | 168 |
169 } // namespace autofill | 169 } // namespace autofill |
OLD | NEW |