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

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

Issue 296593003: Make various string_util functions take StringPieces instead of char[]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resync Created 6 years, 6 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
« no previous file with comments | « base/strings/string_util.cc ('k') | chrome/browser/autocomplete/builtin_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/autocomplete_input.h" 5 #include "chrome/browser/autocomplete/autocomplete_input.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/external_protocol/external_protocol_handler.h" 9 #include "chrome/browser/external_protocol/external_protocol_handler.h"
10 #include "chrome/browser/profiles/profile_io_data.h" 10 #include "chrome/browser/profiles/profile_io_data.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 AutocompleteInput::Type AutocompleteInput::Parse( 126 AutocompleteInput::Type AutocompleteInput::Parse(
127 const base::string16& text, 127 const base::string16& text,
128 const base::string16& desired_tld, 128 const base::string16& desired_tld,
129 url::Parsed* parts, 129 url::Parsed* parts,
130 base::string16* scheme, 130 base::string16* scheme,
131 GURL* canonicalized_url) { 131 GURL* canonicalized_url) {
132 size_t first_non_white = text.find_first_not_of(base::kWhitespaceUTF16, 0); 132 size_t first_non_white = text.find_first_not_of(base::kWhitespaceUTF16, 0);
133 if (first_non_white == base::string16::npos) 133 if (first_non_white == base::string16::npos)
134 return INVALID; // All whitespace. 134 return INVALID; // All whitespace.
135 135
136 if (text.at(first_non_white) == L'?') { 136 if (text[first_non_white] == L'?') {
137 // If the first non-whitespace character is a '?', we magically treat this 137 // If the first non-whitespace character is a '?', we magically treat this
138 // as a query. 138 // as a query.
139 return FORCED_QUERY; 139 return FORCED_QUERY;
140 } 140 }
141 141
142 // Ask our parsing back-end to help us understand what the user typed. We 142 // Ask our parsing back-end to help us understand what the user typed. We
143 // use the URLFixerUpper here because we want to be smart about what we 143 // use the URLFixerUpper here because we want to be smart about what we
144 // consider a scheme. For example, we shouldn't consider www.google.com:80 144 // consider a scheme. For example, we shouldn't consider www.google.com:80
145 // to have a scheme. 145 // to have a scheme.
146 url::Parsed local_parts; 146 url::Parsed local_parts;
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 current_page_classification_ = AutocompleteInput::INVALID_SPEC; 525 current_page_classification_ = AutocompleteInput::INVALID_SPEC;
526 type_ = INVALID; 526 type_ = INVALID;
527 parts_ = url::Parsed(); 527 parts_ = url::Parsed();
528 scheme_.clear(); 528 scheme_.clear();
529 canonicalized_url_ = GURL(); 529 canonicalized_url_ = GURL();
530 prevent_inline_autocomplete_ = false; 530 prevent_inline_autocomplete_ = false;
531 prefer_keyword_ = false; 531 prefer_keyword_ = false;
532 allow_exact_keyword_match_ = false; 532 allow_exact_keyword_match_ = false;
533 want_asynchronous_matches_ = true; 533 want_asynchronous_matches_ = true;
534 } 534 }
OLDNEW
« no previous file with comments | « base/strings/string_util.cc ('k') | chrome/browser/autocomplete/builtin_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698