Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(970)

Side by Side Diff: chrome/browser/autocomplete_history_manager.cc

Issue 8490017: Setting up external delegate calls to allow a future delegate to handle autofill (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Hard coding input element position Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/autocomplete_history_manager.h" 5 #include "chrome/browser/autocomplete_history_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 return; 212 return;
213 } 213 }
214 214
215 DCHECK_EQ(AUTOFILL_VALUE_RESULT, result->GetType()); 215 DCHECK_EQ(AUTOFILL_VALUE_RESULT, result->GetType());
216 const WDResult<std::vector<string16> >* autofill_result = 216 const WDResult<std::vector<string16> >* autofill_result =
217 static_cast<const WDResult<std::vector<string16> >*>(result); 217 static_cast<const WDResult<std::vector<string16> >*>(result);
218 std::vector<string16> suggestions = autofill_result->GetValue(); 218 std::vector<string16> suggestions = autofill_result->GetValue();
219 SendSuggestions(&suggestions); 219 SendSuggestions(&suggestions);
220 } 220 }
221 221
222 void AutocompleteHistoryManager::SetExternalDelegate(
223 AutofillExternalDelegate* delegate) {
224 external_delegate_ = delegate;
225 }
226
222 AutocompleteHistoryManager::AutocompleteHistoryManager( 227 AutocompleteHistoryManager::AutocompleteHistoryManager(
223 TabContents* tab_contents, 228 TabContents* tab_contents,
224 Profile* profile, 229 Profile* profile,
225 WebDataService* wds) 230 WebDataService* wds)
226 : TabContentsObserver(tab_contents), 231 : TabContentsObserver(tab_contents),
227 profile_(profile), 232 profile_(profile),
228 web_data_service_(wds), 233 web_data_service_(wds),
229 pending_query_handle_(0), 234 pending_query_handle_(0),
230 query_id_(0) { 235 query_id_(0) {
231 autofill_enabled_.Init( 236 autofill_enabled_.Init(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 269 }
265 } 270 }
266 271
267 if (external_delegate_) { 272 if (external_delegate_) {
268 external_delegate_->OnSuggestionsReturned( 273 external_delegate_->OnSuggestionsReturned(
269 query_id_, 274 query_id_,
270 autofill_values_, 275 autofill_values_,
271 autofill_labels_, 276 autofill_labels_,
272 autofill_icons_, 277 autofill_icons_,
273 autofill_unique_ids_); 278 autofill_unique_ids_);
279 } else {
280 Send(new AutofillMsg_SuggestionsReturned(routing_id(),
281 query_id_,
282 autofill_values_,
283 autofill_labels_,
284 autofill_icons_,
285 autofill_unique_ids_));
274 } 286 }
275 287
276 Send(new AutofillMsg_SuggestionsReturned(routing_id(),
277 query_id_,
278 autofill_values_,
279 autofill_labels_,
280 autofill_icons_,
281 autofill_unique_ids_));
282
283 query_id_ = 0; 288 query_id_ = 0;
284 autofill_values_.clear(); 289 autofill_values_.clear();
285 autofill_labels_.clear(); 290 autofill_labels_.clear();
286 autofill_icons_.clear(); 291 autofill_icons_.clear();
287 autofill_unique_ids_.clear(); 292 autofill_unique_ids_.clear();
288 } 293 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete_history_manager.h ('k') | chrome/browser/autocomplete_history_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698