OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // Code that wants to format URLs with a format flag including | 257 // Code that wants to format URLs with a format flag including |
258 // net::kFormatUrlOmitTrailingSlashOnBareHostname risk changing the meaning if | 258 // net::kFormatUrlOmitTrailingSlashOnBareHostname risk changing the meaning if |
259 // the result is then parsed as AutocompleteInput. Such code can call this | 259 // the result is then parsed as AutocompleteInput. Such code can call this |
260 // function with the URL and its formatted string, and it will return a | 260 // function with the URL and its formatted string, and it will return a |
261 // formatted string with the same meaning as the original URL (i.e. it will | 261 // formatted string with the same meaning as the original URL (i.e. it will |
262 // re-append a slash if necessary). | 262 // re-append a slash if necessary). |
263 static string16 FormattedStringWithEquivalentMeaning( | 263 static string16 FormattedStringWithEquivalentMeaning( |
264 const GURL& url, | 264 const GURL& url, |
265 const string16& formatted_url); | 265 const string16& formatted_url); |
266 | 266 |
| 267 // Returns the number of non-empty components in |parts| besides the host. |
| 268 static int NumNonHostComponents(const url_parse::Parsed& parts); |
| 269 |
267 // User-provided text to be completed. | 270 // User-provided text to be completed. |
268 const string16& text() const { return text_; } | 271 const string16& text() const { return text_; } |
269 | 272 |
270 // Use of this setter is risky, since no other internal state is updated | 273 // Use of this setter is risky, since no other internal state is updated |
271 // besides |text_| and |parts_|. Only callers who know that they're not | 274 // besides |text_| and |parts_|. Only callers who know that they're not |
272 // changing the type/scheme/etc. should use this. | 275 // changing the type/scheme/etc. should use this. |
273 void UpdateText(const string16& text, const url_parse::Parsed& parts); | 276 void UpdateText(const string16& text, const url_parse::Parsed& parts); |
274 | 277 |
275 // User's desired TLD, if one is not already present in the text to | 278 // User's desired TLD, if one is not already present in the text to |
276 // autocomplete. When this is non-empty, it also implies that "www." should | 279 // autocomplete. When this is non-empty, it also implies that "www." should |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 AutocompleteInput::Type input_type; | 752 AutocompleteInput::Type input_type; |
750 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). | 753 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). |
751 size_t selected_index; | 754 size_t selected_index; |
752 // Inline autocompleted length (if displayed). | 755 // Inline autocompleted length (if displayed). |
753 size_t inline_autocompleted_length; | 756 size_t inline_autocompleted_length; |
754 // Result set. | 757 // Result set. |
755 const AutocompleteResult& result; | 758 const AutocompleteResult& result; |
756 }; | 759 }; |
757 | 760 |
758 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 761 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
OLD | NEW |