| 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 "components/omnibox/history_provider.h" | 5 #include "components/omnibox/history_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 history_service->DeleteURL(match.destination_url); | 32 history_service->DeleteURL(match.destination_url); |
| 33 | 33 |
| 34 DeleteMatchFromMatches(match); | 34 DeleteMatchFromMatches(match); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 bool HistoryProvider::PreventInlineAutocomplete( | 38 bool HistoryProvider::PreventInlineAutocomplete( |
| 39 const AutocompleteInput& input) { | 39 const AutocompleteInput& input) { |
| 40 return input.prevent_inline_autocomplete() || | 40 return input.prevent_inline_autocomplete() || |
| 41 (!input.text().empty() && | 41 (!input.text().empty() && |
| 42 IsWhitespace(input.text()[input.text().length() - 1])); | 42 base::IsUnicodeWhitespace(input.text()[input.text().length() - 1])); |
| 43 } | 43 } |
| 44 | 44 |
| 45 HistoryProvider::HistoryProvider(AutocompleteProvider::Type type, | 45 HistoryProvider::HistoryProvider(AutocompleteProvider::Type type, |
| 46 AutocompleteProviderClient* client) | 46 AutocompleteProviderClient* client) |
| 47 : AutocompleteProvider(type), client_(client) { | 47 : AutocompleteProvider(type), client_(client) { |
| 48 } | 48 } |
| 49 | 49 |
| 50 HistoryProvider::~HistoryProvider() {} | 50 HistoryProvider::~HistoryProvider() {} |
| 51 | 51 |
| 52 void HistoryProvider::DeleteMatchFromMatches(const AutocompleteMatch& match) { | 52 void HistoryProvider::DeleteMatchFromMatches(const AutocompleteMatch& match) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 do { | 96 do { |
| 97 offset += matches[i].length; | 97 offset += matches[i].length; |
| 98 ++i; | 98 ++i; |
| 99 } while ((i < match_count) && (offset == matches[i].offset)); | 99 } while ((i < match_count) && (offset == matches[i].offset)); |
| 100 if (offset < text_length) | 100 if (offset < text_length) |
| 101 spans.push_back(ACMatchClassification(offset, url_style)); | 101 spans.push_back(ACMatchClassification(offset, url_style)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 return spans; | 104 return spans; |
| 105 } | 105 } |
| OLD | NEW |