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

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

Issue 10837244: Replace HistoryQuickProvider protobuf-based caching with an SQLite-based database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Tweak suppression. Created 8 years, 3 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 | Annotate | Revision Log
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 std::string name = "HistoryQuickProvider.QueryIndexTime." + 140 std::string name = "HistoryQuickProvider.QueryIndexTime." +
141 base::IntToString(input.text().length()); 141 base::IntToString(input.text().length());
142 base::Histogram* counter = base::Histogram::FactoryGet( 142 base::Histogram* counter = base::Histogram::FactoryGet(
143 name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag); 143 name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag);
144 counter->Add(static_cast<int>((end_time - start_time).InMilliseconds())); 144 counter->Add(static_cast<int>((end_time - start_time).InMilliseconds()));
145 } 145 }
146 UpdateStarredStateOfMatches(); 146 UpdateStarredStateOfMatches();
147 } 147 }
148 } 148 }
149 149
150 // TODO(mrossetti): Implement this function. (Will happen in next CL.) 150 void HistoryQuickProvider::DeleteMatch(const AutocompleteMatch& match) {
151 void HistoryQuickProvider::DeleteMatch(const AutocompleteMatch& match) {} 151 DCHECK(match.deletable);
152 DCHECK(match.destination_url.is_valid());
153 // Delete the match from the InMemoryURLIndex.
154 GetIndex()->DeleteURL(match.destination_url);
155 DeleteMatchFromMatches(match);
156 }
152 157
153 HistoryQuickProvider::~HistoryQuickProvider() {} 158 HistoryQuickProvider::~HistoryQuickProvider() {}
154 159
155 void HistoryQuickProvider::DoAutocomplete() { 160 void HistoryQuickProvider::DoAutocomplete() {
156 // Get the matching URLs from the DB. 161 // Get the matching URLs from the DB.
157 string16 term_string = autocomplete_input_.text(); 162 string16 term_string = autocomplete_input_.text();
158 ScoredHistoryMatches matches = GetIndex()->HistoryItemsForTerms(term_string); 163 ScoredHistoryMatches matches = GetIndex()->HistoryItemsForTerms(term_string);
159 if (matches.empty()) 164 if (matches.empty())
160 return; 165 return;
161 166
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 do { 293 do {
289 offset += matches[i].length; 294 offset += matches[i].length;
290 ++i; 295 ++i;
291 } while ((i < match_count) && (offset == matches[i].offset)); 296 } while ((i < match_count) && (offset == matches[i].offset));
292 if (offset < text_length) 297 if (offset < text_length)
293 spans.push_back(ACMatchClassification(offset, url_style)); 298 spans.push_back(ACMatchClassification(offset, url_style));
294 } 299 }
295 300
296 return spans; 301 return spans;
297 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698