OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 // * They hit ctrl-enter, or we parsed the input as a URL, or it starts with | 374 // * They hit ctrl-enter, or we parsed the input as a URL, or it starts with |
375 // an explicit "http:" or "https:". | 375 // an explicit "http:" or "https:". |
376 // Otherwise, this is just low-quality noise. In the cases where we've parsed | 376 // Otherwise, this is just low-quality noise. In the cases where we've parsed |
377 // as UNKNOWN, we'll still show an accidental search infobar if need be. | 377 // as UNKNOWN, we'll still show an accidental search infobar if need be. |
378 bool have_what_you_typed_match = | 378 bool have_what_you_typed_match = |
379 params->input.canonicalized_url().is_valid() && | 379 params->input.canonicalized_url().is_valid() && |
380 (params->input.type() != AutocompleteInput::QUERY) && | 380 (params->input.type() != AutocompleteInput::QUERY) && |
381 ((params->input.type() != AutocompleteInput::UNKNOWN) || | 381 ((params->input.type() != AutocompleteInput::UNKNOWN) || |
382 (classifier.type() == VisitClassifier::UNVISITED_INTRANET) || | 382 (classifier.type() == VisitClassifier::UNVISITED_INTRANET) || |
383 !params->trim_http || | 383 !params->trim_http || |
384 url_util::FindAndCompareScheme(UTF16ToUTF8(params->input.text()), | 384 (AutocompleteInput::NumNonHostComponents(params->input.parts()) > 0)); |
385 chrome::kHttpsScheme, NULL)); | |
386 AutocompleteMatch what_you_typed_match(SuggestExactInput(params->input, | 385 AutocompleteMatch what_you_typed_match(SuggestExactInput(params->input, |
387 params->trim_http)); | 386 params->trim_http)); |
388 | 387 |
389 // Get the matching URLs from the DB | 388 // Get the matching URLs from the DB |
390 typedef std::vector<history::URLRow> URLRowVector; | 389 typedef std::vector<history::URLRow> URLRowVector; |
391 URLRowVector url_matches; | 390 URLRowVector url_matches; |
392 history::HistoryMatches history_matches; | 391 history::HistoryMatches history_matches; |
393 | 392 |
394 for (history::Prefixes::const_iterator i(prefixes_.begin()); | 393 for (history::Prefixes::const_iterator i(prefixes_.begin()); |
395 i != prefixes_.end(); ++i) { | 394 i != prefixes_.end(); ++i) { |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 &match.contents_class); | 944 &match.contents_class); |
946 } | 945 } |
947 match.description = info.title(); | 946 match.description = info.title(); |
948 AutocompleteMatch::ClassifyMatchInString(params->input.text(), | 947 AutocompleteMatch::ClassifyMatchInString(params->input.text(), |
949 info.title(), | 948 info.title(), |
950 ACMatchClassification::NONE, | 949 ACMatchClassification::NONE, |
951 &match.description_class); | 950 &match.description_class); |
952 | 951 |
953 return match; | 952 return match; |
954 } | 953 } |
OLD | NEW |