OLD | NEW |
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_provider.h" | 5 #include "chrome/browser/autocomplete/history_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 : AutocompleteProvider(listener, profile, type), | 24 : AutocompleteProvider(listener, profile, type), |
25 always_prevent_inline_autocomplete_(false) { | 25 always_prevent_inline_autocomplete_(false) { |
26 } | 26 } |
27 | 27 |
28 void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) { | 28 void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) { |
29 DCHECK(done_); | 29 DCHECK(done_); |
30 DCHECK(profile_); | 30 DCHECK(profile_); |
31 DCHECK(match.deletable); | 31 DCHECK(match.deletable); |
32 | 32 |
33 HistoryService* const history_service = | 33 HistoryService* const history_service = |
34 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 34 HistoryServiceFactory::GetForProfile( |
| 35 profile_, Profile::EXPLICIT_ACCESS).get(); |
35 | 36 |
36 // Delete the match from the history DB. | 37 // Delete the match from the history DB. |
37 DCHECK(history_service); | 38 DCHECK(history_service); |
38 DCHECK(match.destination_url.is_valid()); | 39 DCHECK(match.destination_url.is_valid()); |
39 history_service->DeleteURL(match.destination_url); | 40 history_service->DeleteURL(match.destination_url); |
40 DeleteMatchFromMatches(match); | 41 DeleteMatchFromMatches(match); |
41 } | 42 } |
42 | 43 |
43 HistoryProvider::~HistoryProvider() {} | 44 HistoryProvider::~HistoryProvider() {} |
44 | 45 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 158 } |
158 | 159 |
159 // static | 160 // static |
160 bool HistoryProvider::PreventInlineAutocomplete( | 161 bool HistoryProvider::PreventInlineAutocomplete( |
161 const AutocompleteInput& input) { | 162 const AutocompleteInput& input) { |
162 return input.prevent_inline_autocomplete() || | 163 return input.prevent_inline_autocomplete() || |
163 always_prevent_inline_autocomplete_ || | 164 always_prevent_inline_autocomplete_ || |
164 (!input.text().empty() && | 165 (!input.text().empty() && |
165 IsWhitespace(input.text()[input.text().length() - 1])); | 166 IsWhitespace(input.text()[input.text().length() - 1])); |
166 } | 167 } |
OLD | NEW |