OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "chrome/browser/autocomplete/autocomplete.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 case QUERY: return "query"; | 73 case QUERY: return "query"; |
74 case FORCED_QUERY: return "forced-query"; | 74 case FORCED_QUERY: return "forced-query"; |
75 | 75 |
76 default: | 76 default: |
77 NOTREACHED(); | 77 NOTREACHED(); |
78 return std::string(); | 78 return std::string(); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 //static | 82 //static |
83 AutocompleteInput::Type AutocompleteInput::Parse(const std::wstring& text, | 83 AutocompleteInput::Type AutocompleteInput::Parse( |
84 const std::wstring& desired_tld
, | 84 const std::wstring& text, |
85 url_parse::Parsed* parts, | 85 const std::wstring& desired_tld, |
86 std::wstring* scheme) { | 86 url_parse::Parsed* parts, |
| 87 std::wstring* scheme) { |
87 DCHECK(parts); | 88 DCHECK(parts); |
88 | 89 |
89 const size_t first_non_white = text.find_first_not_of(kWhitespaceWide, 0); | 90 const size_t first_non_white = text.find_first_not_of(kWhitespaceWide, 0); |
90 if (first_non_white == std::wstring::npos) | 91 if (first_non_white == std::wstring::npos) |
91 return INVALID; // All whitespace. | 92 return INVALID; // All whitespace. |
92 | 93 |
93 if (text.at(first_non_white) == L'?') { | 94 if (text.at(first_non_white) == L'?') { |
94 // If the first non-whitespace character is a '?', we magically treat this | 95 // If the first non-whitespace character is a '?', we magically treat this |
95 // as a query. | 96 // as a query. |
96 return FORCED_QUERY; | 97 return FORCED_QUERY; |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 match.contents_class.push_back( | 831 match.contents_class.push_back( |
831 ACMatchClassification(keyword_offset + input_.text().size(), | 832 ACMatchClassification(keyword_offset + input_.text().size(), |
832 ACMatchClassification::NONE)); | 833 ACMatchClassification::NONE)); |
833 } | 834 } |
834 match.destination_url = | 835 match.destination_url = |
835 HistoryUI::GetHistoryURLWithSearchText(input_.text()); | 836 HistoryUI::GetHistoryURLWithSearchText(input_.text()); |
836 match.transition = PageTransition::AUTO_BOOKMARK; | 837 match.transition = PageTransition::AUTO_BOOKMARK; |
837 match.provider = history_contents_provider_; | 838 match.provider = history_contents_provider_; |
838 latest_result_.AddMatch(match); | 839 latest_result_.AddMatch(match); |
839 } | 840 } |
OLD | NEW |