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 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 #endif // !defined(OS_ANDROID) && !defined(IOS) | 1484 #endif // !defined(OS_ANDROID) && !defined(IOS) |
1485 | 1485 |
1486 const TemplateURL* template_url = is_keyword ? | 1486 const TemplateURL* template_url = is_keyword ? |
1487 providers_.GetKeywordProviderURL() : providers_.GetDefaultProviderURL(); | 1487 providers_.GetKeywordProviderURL() : providers_.GetDefaultProviderURL(); |
1488 AutocompleteMatch match = CreateSearchSuggestion(this, relevance, type, | 1488 AutocompleteMatch match = CreateSearchSuggestion(this, relevance, type, |
1489 template_url, query_string, input_text, input_, is_keyword, | 1489 template_url, query_string, input_text, input_, is_keyword, |
1490 accepted_suggestion, omnibox_start_margin, | 1490 accepted_suggestion, omnibox_start_margin, |
1491 !is_keyword || providers_.default_provider().empty()); | 1491 !is_keyword || providers_.default_provider().empty()); |
1492 if (!match.destination_url.is_valid()) | 1492 if (!match.destination_url.is_valid()) |
1493 return; | 1493 return; |
| 1494 match.search_terms_args->bookmark_bar_pinned = |
| 1495 profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); |
1494 match.RecordAdditionalInfo(kRelevanceFromServerKey, | 1496 match.RecordAdditionalInfo(kRelevanceFromServerKey, |
1495 relevance_from_server ? kTrue : kFalse); | 1497 relevance_from_server ? kTrue : kFalse); |
1496 match.RecordAdditionalInfo(kShouldPrefetchKey, | 1498 match.RecordAdditionalInfo(kShouldPrefetchKey, |
1497 should_prefetch ? kTrue : kFalse); | 1499 should_prefetch ? kTrue : kFalse); |
1498 | 1500 |
1499 // Metadata is needed only for prefetching queries. | 1501 // Metadata is needed only for prefetching queries. |
1500 if (should_prefetch) | 1502 if (should_prefetch) |
1501 match.RecordAdditionalInfo(kSuggestMetadataKey, metadata); | 1503 match.RecordAdditionalInfo(kSuggestMetadataKey, metadata); |
1502 | 1504 |
1503 // Try to add |match| to |map|. If a match for |query_string| is already in | 1505 // Try to add |match| to |map|. If a match for |query_string| is already in |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1647 it->set_relevance(max_query_relevance); | 1649 it->set_relevance(max_query_relevance); |
1648 it->set_relevance_from_server(relevance_from_server); | 1650 it->set_relevance_from_server(relevance_from_server); |
1649 } | 1651 } |
1650 } | 1652 } |
1651 | 1653 |
1652 void SearchProvider::UpdateDone() { | 1654 void SearchProvider::UpdateDone() { |
1653 // We're done when the timer isn't running, there are no suggest queries | 1655 // We're done when the timer isn't running, there are no suggest queries |
1654 // pending, and we're not waiting on Instant. | 1656 // pending, and we're not waiting on Instant. |
1655 done_ = !timer_.IsRunning() && (suggest_results_pending_ == 0); | 1657 done_ = !timer_.IsRunning() && (suggest_results_pending_ == 0); |
1656 } | 1658 } |
OLD | NEW |