Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chrome/browser/autocomplete/url_prefix.cc

Issue 109013006: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/strings/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 base::string16& prefix, size_t num_components) 11 URLPrefix::URLPrefix(const base::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, ());
19 if (prefixes.empty()) { 19 if (prefixes.empty()) {
20 prefixes.push_back(URLPrefix(ASCIIToUTF16("https://www."), 2)); 20 prefixes.push_back(URLPrefix(base::ASCIIToUTF16("https://www."), 2));
21 prefixes.push_back(URLPrefix(ASCIIToUTF16("http://www."), 2)); 21 prefixes.push_back(URLPrefix(base::ASCIIToUTF16("http://www."), 2));
22 prefixes.push_back(URLPrefix(ASCIIToUTF16("ftp://ftp."), 2)); 22 prefixes.push_back(URLPrefix(base::ASCIIToUTF16("ftp://ftp."), 2));
23 prefixes.push_back(URLPrefix(ASCIIToUTF16("ftp://www."), 2)); 23 prefixes.push_back(URLPrefix(base::ASCIIToUTF16("ftp://www."), 2));
24 prefixes.push_back(URLPrefix(ASCIIToUTF16("https://"), 1)); 24 prefixes.push_back(URLPrefix(base::ASCIIToUTF16("https://"), 1));
25 prefixes.push_back(URLPrefix(ASCIIToUTF16("http://"), 1)); 25 prefixes.push_back(URLPrefix(base::ASCIIToUTF16("http://"), 1));
26 prefixes.push_back(URLPrefix(ASCIIToUTF16("ftp://"), 1)); 26 prefixes.push_back(URLPrefix(base::ASCIIToUTF16("ftp://"), 1));
27 prefixes.push_back(URLPrefix(base::string16(), 0)); 27 prefixes.push_back(URLPrefix(base::string16(), 0));
28 } 28 }
29 return prefixes; 29 return prefixes;
30 } 30 }
31 31
32 // static 32 // static
33 bool URLPrefix::IsURLPrefix(const base::string16& prefix) { 33 bool URLPrefix::IsURLPrefix(const base::string16& prefix) {
34 const URLPrefixes& list = GetURLPrefixes(); 34 const URLPrefixes& list = GetURLPrefixes();
35 for (URLPrefixes::const_iterator i = list.begin(); i != list.end(); ++i) 35 for (URLPrefixes::const_iterator i = list.begin(); i != list.end(); ++i)
36 if (i->prefix == prefix) 36 if (i->prefix == prefix)
(...skipping 10 matching lines...) Expand all
47 return &(*i); 47 return &(*i);
48 return NULL; 48 return NULL;
49 } 49 }
50 50
51 // static 51 // static
52 bool URLPrefix::PrefixMatch(const URLPrefix& prefix, 52 bool URLPrefix::PrefixMatch(const URLPrefix& prefix,
53 const base::string16& text, 53 const base::string16& text,
54 const base::string16& prefix_suffix) { 54 const base::string16& prefix_suffix) {
55 return StartsWith(text, prefix.prefix + prefix_suffix, false); 55 return StartsWith(text, prefix.prefix + prefix_suffix, false);
56 } 56 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/shortcuts_provider_unittest.cc ('k') | chrome/browser/autocomplete/zero_suggest_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698