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

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

Issue 329073003: Make HistoryQuickProvider::DeleteMatch also delete the underlying URL from the History Database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 6 years, 6 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 std::string name = "HistoryQuickProvider.QueryIndexTime." + 83 std::string name = "HistoryQuickProvider.QueryIndexTime." +
84 base::IntToString(input.text().length()); 84 base::IntToString(input.text().length());
85 base::HistogramBase* counter = base::Histogram::FactoryGet( 85 base::HistogramBase* counter = base::Histogram::FactoryGet(
86 name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag); 86 name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag);
87 counter->Add(static_cast<int>((end_time - start_time).InMilliseconds())); 87 counter->Add(static_cast<int>((end_time - start_time).InMilliseconds()));
88 } 88 }
89 UpdateStarredStateOfMatches(); 89 UpdateStarredStateOfMatches();
90 } 90 }
91 } 91 }
92 92
93 void HistoryQuickProvider::DeleteMatch(const AutocompleteMatch& match) {
94 DCHECK(match.deletable);
95 DCHECK(match.destination_url.is_valid());
96 // Delete the match from the InMemoryURLIndex.
97 GetIndex()->DeleteURL(match.destination_url);
98 DeleteMatchFromMatches(match);
99 }
100
101 HistoryQuickProvider::~HistoryQuickProvider() {} 93 HistoryQuickProvider::~HistoryQuickProvider() {}
102 94
103 void HistoryQuickProvider::DoAutocomplete() { 95 void HistoryQuickProvider::DoAutocomplete() {
104 // Get the matching URLs from the DB. 96 // Get the matching URLs from the DB.
105 ScoredHistoryMatches matches = GetIndex()->HistoryItemsForTerms( 97 ScoredHistoryMatches matches = GetIndex()->HistoryItemsForTerms(
106 autocomplete_input_.text(), 98 autocomplete_input_.text(),
107 autocomplete_input_.cursor_position(), 99 autocomplete_input_.cursor_position(),
108 AutocompleteProvider::kMaxMatches); 100 AutocompleteProvider::kMaxMatches);
109 if (matches.empty()) 101 if (matches.empty())
110 return; 102 return;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 if (index_for_testing_.get()) 291 if (index_for_testing_.get())
300 return index_for_testing_.get(); 292 return index_for_testing_.get();
301 293
302 HistoryService* const history_service = 294 HistoryService* const history_service =
303 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); 295 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
304 if (!history_service) 296 if (!history_service)
305 return NULL; 297 return NULL;
306 298
307 return history_service->InMemoryIndex(); 299 return history_service->InMemoryIndex();
308 } 300 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_quick_provider.h ('k') | chrome/browser/autocomplete/history_quick_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698