Chromium Code Reviews| 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 #include "chrome/browser/autocomplete/search_provider.h" | 5 #include "chrome/browser/autocomplete/search_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 803 // values preserve that property. Otherwise, if the user starts editing a | 803 // values preserve that property. Otherwise, if the user starts editing a |
| 804 // suggestion, non-Search results will suddenly appear. | 804 // suggestion, non-Search results will suddenly appear. |
| 805 size_t search_start = 0; | 805 size_t search_start = 0; |
| 806 if (input_.type() == AutocompleteInput::FORCED_QUERY) { | 806 if (input_.type() == AutocompleteInput::FORCED_QUERY) { |
| 807 match.fill_into_edit.assign(ASCIIToUTF16("?")); | 807 match.fill_into_edit.assign(ASCIIToUTF16("?")); |
| 808 ++search_start; | 808 ++search_start; |
| 809 } | 809 } |
| 810 if (is_keyword) { | 810 if (is_keyword) { |
| 811 match.fill_into_edit.append( | 811 match.fill_into_edit.append( |
| 812 providers_.keyword_provider().keyword() + char16(' ')); | 812 providers_.keyword_provider().keyword() + char16(' ')); |
| 813 match.template_url = &providers_.keyword_provider(); | 813 match.keyword_url = &providers_.keyword_provider(); |
| 814 match.keyword_state = AutocompleteMatch::KEYWORD; | |
| 815 match.keyword.assign(providers_.keyword_provider().keyword()); | |
|
Peter Kasting
2011/04/13 21:06:59
Nit: Just use =
| |
| 814 } | 816 } |
| 815 match.fill_into_edit.append(query_string); | 817 match.fill_into_edit.append(query_string); |
| 816 // Not all suggestions start with the original input. | 818 // Not all suggestions start with the original input. |
| 817 if (!prevent_inline_autocomplete && | 819 if (!prevent_inline_autocomplete && |
| 818 !match.fill_into_edit.compare(search_start, input_text.length(), | 820 !match.fill_into_edit.compare(search_start, input_text.length(), |
| 819 input_text)) | 821 input_text)) |
| 820 match.inline_autocomplete_offset = search_start + input_text.length(); | 822 match.inline_autocomplete_offset = search_start + input_text.length(); |
| 821 | 823 |
| 822 const TemplateURLRef* const search_url = provider.url(); | 824 const TemplateURLRef* const search_url = provider.url(); |
| 823 DCHECK(search_url->SupportsReplacement()); | 825 DCHECK(search_url->SupportsReplacement()); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 907 match.description_class.push_back( | 909 match.description_class.push_back( |
| 908 ACMatchClassification(0, ACMatchClassification::DIM)); | 910 ACMatchClassification(0, ACMatchClassification::DIM)); |
| 909 // Only the first search match gets a description. | 911 // Only the first search match gets a description. |
| 910 return; | 912 return; |
| 911 | 913 |
| 912 default: | 914 default: |
| 913 break; | 915 break; |
| 914 } | 916 } |
| 915 } | 917 } |
| 916 } | 918 } |
| OLD | NEW |