| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 case FORCED_QUERY: return "forced-query"; | 114 case FORCED_QUERY: return "forced-query"; |
| 115 | 115 |
| 116 default: | 116 default: |
| 117 NOTREACHED(); | 117 NOTREACHED(); |
| 118 return std::string(); | 118 return std::string(); |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 // static | 122 // static |
| 123 AutocompleteInput::Type AutocompleteInput::Parse( | 123 AutocompleteInput::Type AutocompleteInput::Parse( |
| 124 const string16& text, | 124 const base::string16& text, |
| 125 const string16& desired_tld, | 125 const base::string16& desired_tld, |
| 126 url_parse::Parsed* parts, | 126 url_parse::Parsed* parts, |
| 127 string16* scheme, | 127 base::string16* scheme, |
| 128 GURL* canonicalized_url) { | 128 GURL* canonicalized_url) { |
| 129 const size_t first_non_white = text.find_first_not_of(kWhitespaceUTF16, 0); | 129 size_t first_non_white = text.find_first_not_of(base::kWhitespaceUTF16, 0); |
| 130 if (first_non_white == string16::npos) | 130 if (first_non_white == string16::npos) |
| 131 return INVALID; // All whitespace. | 131 return INVALID; // All whitespace. |
| 132 | 132 |
| 133 if (text.at(first_non_white) == L'?') { | 133 if (text.at(first_non_white) == L'?') { |
| 134 // If the first non-whitespace character is a '?', we magically treat this | 134 // If the first non-whitespace character is a '?', we magically treat this |
| 135 // as a query. | 135 // as a query. |
| 136 return FORCED_QUERY; | 136 return FORCED_QUERY; |
| 137 } | 137 } |
| 138 | 138 |
| 139 // Ask our parsing back-end to help us understand what the user typed. We | 139 // Ask our parsing back-end to help us understand what the user typed. We |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 current_page_classification_ = AutocompleteInput::INVALID_SPEC; | 525 current_page_classification_ = AutocompleteInput::INVALID_SPEC; |
| 526 type_ = INVALID; | 526 type_ = INVALID; |
| 527 parts_ = url_parse::Parsed(); | 527 parts_ = url_parse::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 matches_requested_ = ALL_MATCHES; | 533 matches_requested_ = ALL_MATCHES; |
| 534 } | 534 } |
| OLD | NEW |