OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 match.description = annotation; | 422 match.description = annotation; |
423 | 423 |
424 match.allowed_to_be_default_match = (input_text == match_contents); | 424 match.allowed_to_be_default_match = (input_text == match_contents); |
425 | 425 |
426 // When the user forced a query, we need to make sure all the fill_into_edit | 426 // When the user forced a query, we need to make sure all the fill_into_edit |
427 // values preserve that property. Otherwise, if the user starts editing a | 427 // values preserve that property. Otherwise, if the user starts editing a |
428 // suggestion, non-Search results will suddenly appear. | 428 // suggestion, non-Search results will suddenly appear. |
429 if (input.type() == AutocompleteInput::FORCED_QUERY) | 429 if (input.type() == AutocompleteInput::FORCED_QUERY) |
430 match.fill_into_edit.assign(base::ASCIIToUTF16("?")); | 430 match.fill_into_edit.assign(base::ASCIIToUTF16("?")); |
431 if (is_keyword) | 431 if (is_keyword) |
432 match.fill_into_edit.append(match.keyword + char16(' ')); | 432 match.fill_into_edit.append(match.keyword + base::char16(' ')); |
433 if (!input.prevent_inline_autocomplete() && | 433 if (!input.prevent_inline_autocomplete() && |
434 StartsWith(query_string, input_text, false)) { | 434 StartsWith(query_string, input_text, false)) { |
435 match.inline_autocompletion = query_string.substr(input_text.length()); | 435 match.inline_autocompletion = query_string.substr(input_text.length()); |
436 match.allowed_to_be_default_match = true; | 436 match.allowed_to_be_default_match = true; |
437 } | 437 } |
438 match.fill_into_edit.append(query_string); | 438 match.fill_into_edit.append(query_string); |
439 | 439 |
440 const TemplateURLRef& search_url = template_url->url_ref(); | 440 const TemplateURLRef& search_url = template_url->url_ref(); |
441 DCHECK(search_url.SupportsReplacement()); | 441 DCHECK(search_url.SupportsReplacement()); |
442 match.search_terms_args.reset( | 442 match.search_terms_args.reset( |
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 if (!OmniboxFieldTrial::InZeroSuggestFieldTrial() || | 2038 if (!OmniboxFieldTrial::InZeroSuggestFieldTrial() || |
2039 service == NULL || | 2039 service == NULL || |
2040 !service->IsSyncEnabledAndLoggedIn() || | 2040 !service->IsSyncEnabledAndLoggedIn() || |
2041 !sync_prefs.GetPreferredDataTypes(syncer::UserTypes()).Has( | 2041 !sync_prefs.GetPreferredDataTypes(syncer::UserTypes()).Has( |
2042 syncer::PROXY_TABS) || | 2042 syncer::PROXY_TABS) || |
2043 service->GetEncryptedDataTypes().Has(syncer::SESSIONS)) | 2043 service->GetEncryptedDataTypes().Has(syncer::SESSIONS)) |
2044 return false; | 2044 return false; |
2045 | 2045 |
2046 return true; | 2046 return true; |
2047 } | 2047 } |
OLD | NEW |