| 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_url_provider.h" | 5 #include "chrome/browser/autocomplete/history_url_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" |
| 11 #include "chrome/browser/autocomplete/autocomplete.h" | 11 #include "chrome/browser/autocomplete/autocomplete.h" |
| 12 #include "chrome/browser/autocomplete/autocomplete_match.h" | 12 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
| 14 #include "chrome/browser/net/url_fixer_upper.h" | 14 #include "chrome/browser/net/url_fixer_upper.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 17 #include "googleurl/src/url_util.h" | 17 #include "googleurl/src/url_util.h" |
| 18 | 18 |
| 19 HistoryProvider::HistoryProvider(ACProviderListener* listener, | 19 HistoryProvider::HistoryProvider(ACProviderListener* listener, |
| 20 Profile* profile, | 20 Profile* profile, |
| 21 const char* name) | 21 const char* name) |
| 22 : AutocompleteProvider(listener, profile, name), | 22 : AutocompleteProvider(listener, profile, name), |
| 23 always_prevent_inline_autocomplete_(false) { | 23 always_prevent_inline_autocomplete_(false) { |
| 24 } | 24 } |
| 25 | 25 |
| 26 HistoryProvider::~HistoryProvider() {} |
| 27 |
| 26 void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) { | 28 void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) { |
| 27 DCHECK(done_); | 29 DCHECK(done_); |
| 28 DCHECK(profile_); | 30 DCHECK(profile_); |
| 29 DCHECK(match.deletable); | 31 DCHECK(match.deletable); |
| 30 | 32 |
| 31 HistoryService* const history_service = | 33 HistoryService* const history_service = |
| 32 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 34 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
| 33 | 35 |
| 34 // Delete the match from the history DB. | 36 // Delete the match from the history DB. |
| 35 DCHECK(history_service); | 37 DCHECK(history_service); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 153 } |
| 152 | 154 |
| 153 // static | 155 // static |
| 154 bool HistoryProvider::PreventInlineAutocomplete( | 156 bool HistoryProvider::PreventInlineAutocomplete( |
| 155 const AutocompleteInput& input) { | 157 const AutocompleteInput& input) { |
| 156 return input.prevent_inline_autocomplete() || | 158 return input.prevent_inline_autocomplete() || |
| 157 always_prevent_inline_autocomplete_ || | 159 always_prevent_inline_autocomplete_ || |
| 158 (!input.text().empty() && | 160 (!input.text().empty() && |
| 159 IsWhitespace(input.text()[input.text().length() - 1])); | 161 IsWhitespace(input.text()[input.text().length() - 1])); |
| 160 } | 162 } |
| OLD | NEW |