OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/url_prefix.h" | 5 #include "components/omnibox/browser/url_prefix.h" |
6 | 6 |
7 #include "base/basictypes.h" | |
8 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
9 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
11 | 10 |
12 namespace { | 11 namespace { |
13 | 12 |
14 // Like URLPrefix::BestURLPrefix() except also handles the prefix of | 13 // Like URLPrefix::BestURLPrefix() except also handles the prefix of |
15 // "www.". | 14 // "www.". |
16 const URLPrefix* BestURLPrefixWithWWWCase( | 15 const URLPrefix* BestURLPrefixWithWWWCase( |
17 const base::string16& text, | 16 const base::string16& text, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 if (!best_prefix && !fixed_up_input.empty() && (fixed_up_input != input)) { | 93 if (!best_prefix && !fixed_up_input.empty() && (fixed_up_input != input)) { |
95 best_prefix = allow_www_prefix_without_scheme ? | 94 best_prefix = allow_www_prefix_without_scheme ? |
96 BestURLPrefixWithWWWCase(text, fixed_up_input) : | 95 BestURLPrefixWithWWWCase(text, fixed_up_input) : |
97 BestURLPrefix(text, fixed_up_input); | 96 BestURLPrefix(text, fixed_up_input); |
98 matching_string = &fixed_up_input; | 97 matching_string = &fixed_up_input; |
99 } | 98 } |
100 return (best_prefix != NULL) ? | 99 return (best_prefix != NULL) ? |
101 (best_prefix->prefix.length() + matching_string->length()) : | 100 (best_prefix->prefix.length() + matching_string->length()) : |
102 base::string16::npos; | 101 base::string16::npos; |
103 } | 102 } |
OLD | NEW |