diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-30 08:16:10 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-30 08:16:10 +0000 |
commit | ef92dbefb269e1ca548ccb7a7fecb1d69c3a87fe (patch) | |
tree | 092af8f9dd66777c0b34975cf999d54b37d6279e /chrome/browser/autocomplete | |
parent | c8884db174f04db3f766da5d3caadbd2432c6f84 (diff) | |
download | chromium_src-ef92dbefb269e1ca548ccb7a7fecb1d69c3a87fe.zip chromium_src-ef92dbefb269e1ca548ccb7a7fecb1d69c3a87fe.tar.gz chromium_src-ef92dbefb269e1ca548ccb7a7fecb1d69c3a87fe.tar.bz2 |
Make various string_util functions take StringPieces instead of char[].
This allows most callers to pass string literals or results of ASCIIToUTF16(),
rather than construct error-prone character arrays that must be manually
nul-terminated.
Also cleans up various bits of the callers.
BUG=104260
TEST=none
Review URL: https://codereview.chromium.org/296593003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273765 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_input.cc | 2 | ||||
-rw-r--r-- | chrome/browser/autocomplete/builtin_provider.cc | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_input.cc b/chrome/browser/autocomplete/autocomplete_input.cc index af34933..f85b5db 100644 --- a/chrome/browser/autocomplete/autocomplete_input.cc +++ b/chrome/browser/autocomplete/autocomplete_input.cc @@ -133,7 +133,7 @@ AutocompleteInput::Type AutocompleteInput::Parse( if (first_non_white == base::string16::npos) return INVALID; // All whitespace. - if (text.at(first_non_white) == L'?') { + if (text[first_non_white] == L'?') { // If the first non-whitespace character is a '?', we magically treat this // as a query. return FORCED_QUERY; diff --git a/chrome/browser/autocomplete/builtin_provider.cc b/chrome/browser/autocomplete/builtin_provider.cc index 5b35c75..df0fc43 100644 --- a/chrome/browser/autocomplete/builtin_provider.cc +++ b/chrome/browser/autocomplete/builtin_provider.cc @@ -107,8 +107,7 @@ void BuiltinProvider::Start(const AutocompleteInput& input, !url.has_query() && !url.has_ref()) { // Include the path for sub-pages (e.g. "chrome://settings/browser"). base::string16 host_and_path = base::UTF8ToUTF16(url.host() + url.path()); - base::TrimString(host_and_path, base::ASCIIToUTF16("/").c_str(), - &host_and_path); + base::TrimString(host_and_path, base::ASCIIToUTF16("/"), &host_and_path); size_t match_length = kChrome.length() + host_and_path.length(); for (Builtins::const_iterator i(builtins_.begin()); (i != builtins_.end()) && (matches_.size() < kMaxMatches); ++i) { |