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