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 "chrome/browser/autocomplete/url_prefix.h" | 5 #include "chrome/browser/autocomplete/url_prefix.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 | 10 |
11 URLPrefix::URLPrefix(const string16& prefix, size_t num_components) | 11 URLPrefix::URLPrefix(const string16& prefix, size_t num_components) |
12 : prefix(prefix), | 12 : prefix(prefix), |
13 num_components(num_components) { | 13 num_components(num_components) { |
14 } | 14 } |
15 | 15 |
16 // static | 16 // static |
17 const URLPrefixes& URLPrefix::GetURLPrefixes() { | 17 const URLPrefixes& URLPrefix::GetURLPrefixes() { |
18 CR_DEFINE_STATIC_LOCAL(URLPrefixes, prefixes, ()); | 18 CR_DEFINE_STATIC_LOCAL(URLPrefixes, prefixes, ()); |
(...skipping 21 matching lines...) Expand all Loading... |
40 | 40 |
41 // static | 41 // static |
42 const URLPrefix* URLPrefix::BestURLPrefix(const string16& text, | 42 const URLPrefix* URLPrefix::BestURLPrefix(const string16& text, |
43 const string16& prefix_suffix) { | 43 const string16& prefix_suffix) { |
44 const URLPrefixes& list = GetURLPrefixes(); | 44 const URLPrefixes& list = GetURLPrefixes(); |
45 for (URLPrefixes::const_iterator i = list.begin(); i != list.end(); ++i) | 45 for (URLPrefixes::const_iterator i = list.begin(); i != list.end(); ++i) |
46 if (StartsWith(text, i->prefix + prefix_suffix, false)) | 46 if (StartsWith(text, i->prefix + prefix_suffix, false)) |
47 return &(*i); | 47 return &(*i); |
48 return NULL; | 48 return NULL; |
49 } | 49 } |
OLD | NEW |