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

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: 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete/history_quick_provider_unittest.cc » ('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 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) { 93 void HistoryQuickProvider::DeleteMatch(const AutocompleteMatch& match) {
Peter Kasting 2014/06/11 18:32:34 This function seems like it now just does what His
engedy 2014/06/12 08:47:59 Done. You are entirely correct. I actually feel ki
94 DCHECK(match.deletable); 94 DCHECK(match.deletable);
95 DCHECK(match.destination_url.is_valid()); 95 DCHECK(match.destination_url.is_valid());
96 // Delete the match from the InMemoryURLIndex. 96
97 // Delete the underlying URL along with all its visits from the history DB.
98 HistoryService* const history_service =
99 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
100 DCHECK(history_service);
101 history_service->DeleteURL(match.destination_url);
102
103 // Delete derived information stored about the URL in the InMemoryURLIndex.
97 GetIndex()->DeleteURL(match.destination_url); 104 GetIndex()->DeleteURL(match.destination_url);
105
98 DeleteMatchFromMatches(match); 106 DeleteMatchFromMatches(match);
99 } 107 }
100 108
101 HistoryQuickProvider::~HistoryQuickProvider() {} 109 HistoryQuickProvider::~HistoryQuickProvider() {}
102 110
103 void HistoryQuickProvider::DoAutocomplete() { 111 void HistoryQuickProvider::DoAutocomplete() {
104 // Get the matching URLs from the DB. 112 // Get the matching URLs from the DB.
105 ScoredHistoryMatches matches = GetIndex()->HistoryItemsForTerms( 113 ScoredHistoryMatches matches = GetIndex()->HistoryItemsForTerms(
106 autocomplete_input_.text(), 114 autocomplete_input_.text(),
107 autocomplete_input_.cursor_position(), 115 autocomplete_input_.cursor_position(),
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 if (index_for_testing_.get()) 307 if (index_for_testing_.get())
300 return index_for_testing_.get(); 308 return index_for_testing_.get();
301 309
302 HistoryService* const history_service = 310 HistoryService* const history_service =
303 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); 311 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
304 if (!history_service) 312 if (!history_service)
305 return NULL; 313 return NULL;
306 314
307 return history_service->InMemoryIndex(); 315 return history_service->InMemoryIndex();
308 } 316 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/history_quick_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698