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

Side by Side Diff: chrome/browser/autocomplete/history_quick_provider.cc

Issue 296743009: Pass AutocompleteProvider::kMaxMatches to InMemoryURLIndex (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 7 months 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
« no previous file with comments | « no previous file | chrome/browser/history/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_quick_provider.h" 5 #include "chrome/browser/autocomplete/history_quick_provider.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 GetIndex()->DeleteURL(match.destination_url); 96 GetIndex()->DeleteURL(match.destination_url);
97 DeleteMatchFromMatches(match); 97 DeleteMatchFromMatches(match);
98 } 98 }
99 99
100 HistoryQuickProvider::~HistoryQuickProvider() {} 100 HistoryQuickProvider::~HistoryQuickProvider() {}
101 101
102 void HistoryQuickProvider::DoAutocomplete() { 102 void HistoryQuickProvider::DoAutocomplete() {
103 // Get the matching URLs from the DB. 103 // Get the matching URLs from the DB.
104 ScoredHistoryMatches matches = GetIndex()->HistoryItemsForTerms( 104 ScoredHistoryMatches matches = GetIndex()->HistoryItemsForTerms(
105 autocomplete_input_.text(), 105 autocomplete_input_.text(),
106 autocomplete_input_.cursor_position()); 106 autocomplete_input_.cursor_position(),
107 AutocompleteProvider::kMaxMatches);
107 if (matches.empty()) 108 if (matches.empty())
108 return; 109 return;
109 110
110 // Figure out if HistoryURL provider has a URL-what-you-typed match 111 // Figure out if HistoryURL provider has a URL-what-you-typed match
111 // that ought to go first and what its score will be. 112 // that ought to go first and what its score will be.
112 bool will_have_url_what_you_typed_match_first = false; 113 bool will_have_url_what_you_typed_match_first = false;
113 int url_what_you_typed_match_score = -1; // undefined 114 int url_what_you_typed_match_score = -1; // undefined
114 // These are necessary (but not sufficient) conditions for the omnibox 115 // These are necessary (but not sufficient) conditions for the omnibox
115 // input to be a URL-what-you-typed match. The username test checks that 116 // input to be a URL-what-you-typed match. The username test checks that
116 // either the username does not exist (a regular URL such as http://site/) 117 // either the username does not exist (a regular URL such as http://site/)
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 if (index_for_testing_.get()) 298 if (index_for_testing_.get())
298 return index_for_testing_.get(); 299 return index_for_testing_.get();
299 300
300 HistoryService* const history_service = 301 HistoryService* const history_service =
301 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); 302 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
302 if (!history_service) 303 if (!history_service)
303 return NULL; 304 return NULL;
304 305
305 return history_service->InMemoryIndex(); 306 return history_service->InMemoryIndex();
306 } 307 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698