Chromium Code Reviews| 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/browser/history_url_provider.h" | 5 #include "components/omnibox/browser/history_url_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/feature_list.h" | |
| 11 #include "base/location.h" | 12 #include "base/location.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/threading/sequenced_task_runner_handle.h" | 18 #include "base/threading/sequenced_task_runner_handle.h" |
| 18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 19 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
| 20 #include "components/bookmarks/browser/bookmark_utils.h" | 21 #include "components/bookmarks/browser/bookmark_utils.h" |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 609 match.contents, | 610 match.contents, |
| 610 ACMatchClassification::URL, | 611 ACMatchClassification::URL, |
| 611 &match.contents_class); | 612 &match.contents_class); |
| 612 } else { | 613 } else { |
| 613 AutocompleteMatch::ClassifyLocationInString( | 614 AutocompleteMatch::ClassifyLocationInString( |
| 614 best_prefix->prefix.length() - offset, input.text().length(), | 615 best_prefix->prefix.length() - offset, input.text().length(), |
| 615 match.contents.length(), ACMatchClassification::URL, | 616 match.contents.length(), ACMatchClassification::URL, |
| 616 &match.contents_class); | 617 &match.contents_class); |
| 617 } | 618 } |
| 618 } | 619 } |
| 619 | 620 if (base::FeatureList::IsEnabled(omnibox::kDisplayTitleForCurrentUrl)) { |
|
Mark P
2017/04/12 05:07:56
I don't this this is right. SuggestExactInput can
gcomanici
2017/04/12 16:16:30
Done.
| |
| 621 match.description = input.current_title(); | |
| 622 AutocompleteMatch::ClassifyLocationInString( | |
| 623 base::string16::npos, 0, match.description.length(), | |
| 624 ACMatchClassification::NONE, &match.description_class); | |
| 625 } | |
| 620 return match; | 626 return match; |
| 621 } | 627 } |
| 622 | 628 |
| 623 void HistoryURLProvider::ExecuteWithDB(HistoryURLProviderParams* params, | 629 void HistoryURLProvider::ExecuteWithDB(HistoryURLProviderParams* params, |
| 624 history::HistoryBackend* backend, | 630 history::HistoryBackend* backend, |
| 625 history::URLDatabase* db) { | 631 history::URLDatabase* db) { |
| 626 // We may get called with a null database if it couldn't be properly | 632 // We may get called with a null database if it couldn't be properly |
| 627 // initialized. | 633 // initialized. |
| 628 if (!db) { | 634 if (!db) { |
| 629 params->failed = true; | 635 params->failed = true; |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1187 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, | 1193 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, |
| 1188 match.contents.length(), ACMatchClassification::URL, | 1194 match.contents.length(), ACMatchClassification::URL, |
| 1189 &match.contents_class); | 1195 &match.contents_class); |
| 1190 } | 1196 } |
| 1191 match.description = info.title(); | 1197 match.description = info.title(); |
| 1192 match.description_class = | 1198 match.description_class = |
| 1193 ClassifyDescription(params.input.text(), match.description); | 1199 ClassifyDescription(params.input.text(), match.description); |
| 1194 RecordAdditionalInfoFromUrlRow(info, &match); | 1200 RecordAdditionalInfoFromUrlRow(info, &match); |
| 1195 return match; | 1201 return match; |
| 1196 } | 1202 } |
| OLD | NEW |