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 #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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 // NOTE: Remember to call OnProviderUpdate() if matches_ is updated. | 525 // NOTE: Remember to call OnProviderUpdate() if matches_ is updated. |
526 virtual void DeleteMatch(const AutocompleteMatch& match) {} | 526 virtual void DeleteMatch(const AutocompleteMatch& match) {} |
527 | 527 |
528 static void set_max_matches(size_t max_matches) { | 528 static void set_max_matches(size_t max_matches) { |
529 max_matches_ = max_matches; | 529 max_matches_ = max_matches; |
530 } | 530 } |
531 | 531 |
532 static size_t max_matches() { return max_matches_; } | 532 static size_t max_matches() { return max_matches_; } |
533 | 533 |
534 protected: | 534 protected: |
| 535 // Trims "http:" and up to two subsequent slashes from |url|. Returns the |
| 536 // number of characters that were trimmed. |
| 537 static size_t TrimHttpPrefix(std::wstring* url); |
| 538 |
535 // Updates the starred state of each of the matches in matches_ from the | 539 // Updates the starred state of each of the matches in matches_ from the |
536 // profile's bookmark bar model. | 540 // profile's bookmark bar model. |
537 void UpdateStarredStateOfMatches(); | 541 void UpdateStarredStateOfMatches(); |
538 | 542 |
539 // A convenience function to call gfx::GetCleanStringFromUrl() with the | 543 // A convenience function to call gfx::GetCleanStringFromUrl() with the |
540 // current set of "Accept Languages" when check_accept_lang is true. | 544 // current set of "Accept Languages" when check_accept_lang is true. |
541 // Otherwise, it's called with an empty list. | 545 // Otherwise, it's called with an empty list. |
542 std::wstring StringForURLDisplay(const GURL& url, | 546 std::wstring StringForURLDisplay(const GURL& url, |
543 bool check_accept_lang) const; | 547 bool check_accept_lang) const; |
544 | 548 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 AutocompleteInput::Type input_type; | 845 AutocompleteInput::Type input_type; |
842 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). | 846 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). |
843 size_t selected_index; | 847 size_t selected_index; |
844 // Inline autocompleted length (if displayed). | 848 // Inline autocompleted length (if displayed). |
845 size_t inline_autocompleted_length; | 849 size_t inline_autocompleted_length; |
846 // Result set. | 850 // Result set. |
847 const AutocompleteResult& result; | 851 const AutocompleteResult& result; |
848 }; | 852 }; |
849 | 853 |
850 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 854 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
OLD | NEW |