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/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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 return std::string(); | 123 return std::string(); |
124 } | 124 } |
125 | 125 |
126 // static | 126 // static |
127 AutocompleteInput::Type AutocompleteInput::Parse( | 127 AutocompleteInput::Type AutocompleteInput::Parse( |
128 const base::string16& text, | 128 const base::string16& text, |
129 const base::string16& desired_tld, | 129 const base::string16& desired_tld, |
130 url::Parsed* parts, | 130 url::Parsed* parts, |
131 base::string16* scheme, | 131 base::string16* scheme, |
132 GURL* canonicalized_url) { | 132 GURL* canonicalized_url) { |
133 // NOT FOR COMMIT: Remove this once trybots make it clear no callers call this | |
Mark P
2014/06/19 21:35:14
Remember me.
| |
134 // on a non-UI thread. | |
135 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI) || | |
136 !content::BrowserThread::IsThreadInitialized(content::BrowserThread::UI)); | |
137 | |
133 size_t first_non_white = text.find_first_not_of(base::kWhitespaceUTF16, 0); | 138 size_t first_non_white = text.find_first_not_of(base::kWhitespaceUTF16, 0); |
134 if (first_non_white == base::string16::npos) | 139 if (first_non_white == base::string16::npos) |
135 return metrics::OmniboxInputType::INVALID; // All whitespace. | 140 return metrics::OmniboxInputType::INVALID; // All whitespace. |
136 | 141 |
137 if (text[first_non_white] == L'?') { | 142 if (text[first_non_white] == L'?') { |
138 // If the first non-whitespace character is a '?', we magically treat this | 143 // If the first non-whitespace character is a '?', we magically treat this |
139 // as a query. | 144 // as a query. |
140 return metrics::OmniboxInputType::FORCED_QUERY; | 145 return metrics::OmniboxInputType::FORCED_QUERY; |
141 } | 146 } |
142 | 147 |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
533 current_page_classification_ = AutocompleteInput::INVALID_SPEC; | 538 current_page_classification_ = AutocompleteInput::INVALID_SPEC; |
534 type_ = metrics::OmniboxInputType::INVALID; | 539 type_ = metrics::OmniboxInputType::INVALID; |
535 parts_ = url::Parsed(); | 540 parts_ = url::Parsed(); |
536 scheme_.clear(); | 541 scheme_.clear(); |
537 canonicalized_url_ = GURL(); | 542 canonicalized_url_ = GURL(); |
538 prevent_inline_autocomplete_ = false; | 543 prevent_inline_autocomplete_ = false; |
539 prefer_keyword_ = false; | 544 prefer_keyword_ = false; |
540 allow_exact_keyword_match_ = false; | 545 allow_exact_keyword_match_ = false; |
541 want_asynchronous_matches_ = true; | 546 want_asynchronous_matches_ = true; |
542 } | 547 } |
OLD | NEW |