| 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" |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 // the user did anything to indicate the desired match is a URL. For | 938 // the user did anything to indicate the desired match is a URL. For |
| 939 // instance, "c/# foo" will not pass the test because that will be classified | 939 // instance, "c/# foo" will not pass the test because that will be classified |
| 940 // as input type URL. The parsed.CountCharactersBefore() in the test looks | 940 // as input type URL. The parsed.CountCharactersBefore() in the test looks |
| 941 // for the presence of a reference fragment in the URL by checking whether | 941 // for the presence of a reference fragment in the URL by checking whether |
| 942 // the position differs included the delimiter (pound sign) versus not | 942 // the position differs included the delimiter (pound sign) versus not |
| 943 // including the delimiter. (One cannot simply check url.ref() because it | 943 // including the delimiter. (One cannot simply check url.ref() because it |
| 944 // will not distinguish between the input "c" and the input "c#", both of | 944 // will not distinguish between the input "c" and the input "c#", both of |
| 945 // which will have empty reference fragments.) | 945 // which will have empty reference fragments.) |
| 946 if ((type == UNVISITED_INTRANET) && | 946 if ((type == UNVISITED_INTRANET) && |
| 947 (params->input.type() != metrics::OmniboxInputType::URL) && | 947 (params->input.type() != metrics::OmniboxInputType::URL) && |
| 948 url.username().empty() && url.password().empty() && | 948 url.username().empty() && url.password().empty() && url.port().empty() && |
| 949 url.port().empty() && (url.path() == "/") && url.query().empty() && | 949 (url.path_piece() == "/") && url.query().empty() && |
| 950 (parsed.CountCharactersBefore(url::Parsed::REF, true) != | 950 (parsed.CountCharactersBefore(url::Parsed::REF, true) != |
| 951 parsed.CountCharactersBefore(url::Parsed::REF, false))) { | 951 parsed.CountCharactersBefore(url::Parsed::REF, false))) { |
| 952 return false; | 952 return false; |
| 953 } | 953 } |
| 954 | 954 |
| 955 params->what_you_typed_match.allowed_to_be_default_match = true; | 955 params->what_you_typed_match.allowed_to_be_default_match = true; |
| 956 params->what_you_typed_match.relevance = CalculateRelevance(type, 0); | 956 params->what_you_typed_match.relevance = CalculateRelevance(type, 0); |
| 957 | 957 |
| 958 // If there are any other matches, then don't promote this match here, in | 958 // If there are any other matches, then don't promote this match here, in |
| 959 // hopes the caller will be able to inline autocomplete a better suggestion. | 959 // hopes the caller will be able to inline autocomplete a better suggestion. |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, | 1192 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, |
| 1193 match.contents.length(), ACMatchClassification::URL, | 1193 match.contents.length(), ACMatchClassification::URL, |
| 1194 &match.contents_class); | 1194 &match.contents_class); |
| 1195 } | 1195 } |
| 1196 match.description = info.title(); | 1196 match.description = info.title(); |
| 1197 match.description_class = | 1197 match.description_class = |
| 1198 ClassifyDescription(params.input.text(), match.description); | 1198 ClassifyDescription(params.input.text(), match.description); |
| 1199 RecordAdditionalInfoFromUrlRow(info, &match); | 1199 RecordAdditionalInfoFromUrlRow(info, &match); |
| 1200 return match; | 1200 return match; |
| 1201 } | 1201 } |
| OLD | NEW |