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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 // values preserve that property. Otherwise, if the user starts editing a | 867 // values preserve that property. Otherwise, if the user starts editing a |
868 // suggestion, non-Search results will suddenly appear. | 868 // suggestion, non-Search results will suddenly appear. |
869 size_t search_start = 0; | 869 size_t search_start = 0; |
870 if (input_.type() == AutocompleteInput::FORCED_QUERY) { | 870 if (input_.type() == AutocompleteInput::FORCED_QUERY) { |
871 match.fill_into_edit.assign(ASCIIToUTF16("?")); | 871 match.fill_into_edit.assign(ASCIIToUTF16("?")); |
872 ++search_start; | 872 ++search_start; |
873 } | 873 } |
874 if (is_keyword) { | 874 if (is_keyword) { |
875 match.fill_into_edit.append( | 875 match.fill_into_edit.append( |
876 providers_.keyword_provider().keyword() + char16(' ')); | 876 providers_.keyword_provider().keyword() + char16(' ')); |
877 search_start += providers_.keyword_provider().keyword().size() + 1; | 877 |
| 878 match.keyword = providers_.keyword_provider().keyword(); |
| 879 search_start += match.keyword.size() + 1; |
878 } | 880 } |
879 match.fill_into_edit.append(query_string); | 881 match.fill_into_edit.append(query_string); |
880 // Not all suggestions start with the original input. | 882 // Not all suggestions start with the original input. |
881 if (!prevent_inline_autocomplete && | 883 if (!prevent_inline_autocomplete && |
882 !match.fill_into_edit.compare(search_start, input_text.length(), | 884 !match.fill_into_edit.compare(search_start, input_text.length(), |
883 input_text)) | 885 input_text)) |
884 match.inline_autocomplete_offset = search_start + input_text.length(); | 886 match.inline_autocomplete_offset = search_start + input_text.length(); |
885 | 887 |
886 const TemplateURLRef* const search_url = provider.url(); | 888 const TemplateURLRef* const search_url = provider.url(); |
887 DCHECK(search_url->SupportsReplacement()); | 889 DCHECK(search_url->SupportsReplacement()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 | 945 |
944 return match; | 946 return match; |
945 } | 947 } |
946 | 948 |
947 void SearchProvider::UpdateDone() { | 949 void SearchProvider::UpdateDone() { |
948 // We're done when there are no more suggest queries pending (this is set to 1 | 950 // We're done when there are no more suggest queries pending (this is set to 1 |
949 // when the timer is started) and we're not waiting on instant. | 951 // when the timer is started) and we're not waiting on instant. |
950 done_ = ((suggest_results_pending_ == 0) && | 952 done_ = ((suggest_results_pending_ == 0) && |
951 (instant_finalized_ || !InstantController::IsEnabled(profile_))); | 953 (instant_finalized_ || !InstantController::IsEnabled(profile_))); |
952 } | 954 } |
OLD | NEW |