| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/search_provider.h" | 5 #include "chrome/browser/autocomplete/search_provider.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 } else { | 709 } else { |
| 710 // TODO(beng): ACMatchClassification::MATCH now seems to just mean | 710 // TODO(beng): ACMatchClassification::MATCH now seems to just mean |
| 711 // "bold" this. Consider modifying the terminology. | 711 // "bold" this. Consider modifying the terminology. |
| 712 // We don't iterate over the string here annotating all matches because | 712 // We don't iterate over the string here annotating all matches because |
| 713 // it looks odd to have every occurrence of a substring that may be as | 713 // it looks odd to have every occurrence of a substring that may be as |
| 714 // short as a single character highlighted in a query suggestion result, | 714 // short as a single character highlighted in a query suggestion result, |
| 715 // e.g. for input text "s" and query string "southwest airlines", it | 715 // e.g. for input text "s" and query string "southwest airlines", it |
| 716 // looks odd if both the first and last s are highlighted. | 716 // looks odd if both the first and last s are highlighted. |
| 717 if (input_position != 0) { | 717 if (input_position != 0) { |
| 718 match.contents_class.push_back( | 718 match.contents_class.push_back( |
| 719 ACMatchClassification(0, ACMatchClassification::MATCH)); | 719 ACMatchClassification(0, ACMatchClassification::NONE)); |
| 720 } | 720 } |
| 721 match.contents_class.push_back( | 721 match.contents_class.push_back( |
| 722 ACMatchClassification(input_position, ACMatchClassification::NONE)); | 722 ACMatchClassification(input_position, ACMatchClassification::DIM)); |
| 723 size_t next_fragment_position = input_position + input_text.length(); | 723 size_t next_fragment_position = input_position + input_text.length(); |
| 724 if (next_fragment_position < query_string.length()) { | 724 if (next_fragment_position < query_string.length()) { |
| 725 match.contents_class.push_back( | 725 match.contents_class.push_back( |
| 726 ACMatchClassification(next_fragment_position, | 726 ACMatchClassification(next_fragment_position, |
| 727 ACMatchClassification::MATCH)); | 727 ACMatchClassification::NONE)); |
| 728 } | 728 } |
| 729 } | 729 } |
| 730 } else { | 730 } else { |
| 731 // Otherwise, we're dealing with the "default search" result which has no | 731 // Otherwise, we're dealing with the "default search" result which has no |
| 732 // completion, but has the search provider name as the description. | 732 // completion, but has the search provider name as the description. |
| 733 match.contents.assign(query_string); | 733 match.contents.assign(query_string); |
| 734 match.contents_class.push_back( | 734 match.contents_class.push_back( |
| 735 ACMatchClassification(0, ACMatchClassification::NONE)); | 735 ACMatchClassification(0, ACMatchClassification::NONE)); |
| 736 match.description.assign(l10n_util::GetStringF( | 736 match.description.assign(l10n_util::GetStringF( |
| 737 IDS_AUTOCOMPLETE_SEARCH_DESCRIPTION, | 737 IDS_AUTOCOMPLETE_SEARCH_DESCRIPTION, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 // values preserve that property. Otherwise, if the user starts editing a | 816 // values preserve that property. Otherwise, if the user starts editing a |
| 817 // suggestion, non-Search results will suddenly appear. | 817 // suggestion, non-Search results will suddenly appear. |
| 818 if (input_.type() == AutocompleteInput::FORCED_QUERY) | 818 if (input_.type() == AutocompleteInput::FORCED_QUERY) |
| 819 match.fill_into_edit.assign(L"?"); | 819 match.fill_into_edit.assign(L"?"); |
| 820 match.fill_into_edit.append(match.contents); | 820 match.fill_into_edit.append(match.contents); |
| 821 // TODO(pkasting): http://b/1112879 These should perhaps be | 821 // TODO(pkasting): http://b/1112879 These should perhaps be |
| 822 // inline-autocompletable? | 822 // inline-autocompletable? |
| 823 | 823 |
| 824 return match; | 824 return match; |
| 825 } | 825 } |
| OLD | NEW |