| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/omnibox/browser/base_search_provider.h" | 5 #include "components/omnibox/browser/base_search_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 match.allowed_to_be_default_match = true; | 258 match.allowed_to_be_default_match = true; |
| 259 } | 259 } |
| 260 match.fill_into_edit.append(suggestion.suggestion()); | 260 match.fill_into_edit.append(suggestion.suggestion()); |
| 261 | 261 |
| 262 const TemplateURLRef& search_url = template_url->url_ref(); | 262 const TemplateURLRef& search_url = template_url->url_ref(); |
| 263 DCHECK(search_url.SupportsReplacement(search_terms_data)); | 263 DCHECK(search_url.SupportsReplacement(search_terms_data)); |
| 264 match.search_terms_args.reset( | 264 match.search_terms_args.reset( |
| 265 new TemplateURLRef::SearchTermsArgs(suggestion.suggestion())); | 265 new TemplateURLRef::SearchTermsArgs(suggestion.suggestion())); |
| 266 match.search_terms_args->original_query = input.text(); | 266 match.search_terms_args->original_query = input.text(); |
| 267 match.search_terms_args->accepted_suggestion = accepted_suggestion; | 267 match.search_terms_args->accepted_suggestion = accepted_suggestion; |
| 268 match.search_terms_args->enable_omnibox_start_margin = true; | |
| 269 match.search_terms_args->suggest_query_params = | 268 match.search_terms_args->suggest_query_params = |
| 270 suggestion.suggest_query_params(); | 269 suggestion.suggest_query_params(); |
| 271 match.search_terms_args->append_extra_query_params = | 270 match.search_terms_args->append_extra_query_params = |
| 272 append_extra_query_params; | 271 append_extra_query_params; |
| 273 // This is the destination URL sans assisted query stats. This must be set | 272 // This is the destination URL sans assisted query stats. This must be set |
| 274 // so the AutocompleteController can properly de-dupe; the controller will | 273 // so the AutocompleteController can properly de-dupe; the controller will |
| 275 // eventually overwrite it before it reaches the user. | 274 // eventually overwrite it before it reaches the user. |
| 276 match.destination_url = | 275 match.destination_url = |
| 277 GURL(search_url.ReplaceSearchTerms(*match.search_terms_args.get(), | 276 GURL(search_url.ReplaceSearchTerms(*match.search_terms_args.get(), |
| 278 search_terms_data)); | 277 search_terms_data)); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 bool mark_as_deletable, | 364 bool mark_as_deletable, |
| 366 bool in_keyword_mode, | 365 bool in_keyword_mode, |
| 367 MatchMap* map) { | 366 MatchMap* map) { |
| 368 AutocompleteMatch match = CreateSearchSuggestion( | 367 AutocompleteMatch match = CreateSearchSuggestion( |
| 369 this, GetInput(result.from_keyword_provider()), in_keyword_mode, result, | 368 this, GetInput(result.from_keyword_provider()), in_keyword_mode, result, |
| 370 GetTemplateURL(result.from_keyword_provider()), | 369 GetTemplateURL(result.from_keyword_provider()), |
| 371 client_->GetTemplateURLService()->search_terms_data(), | 370 client_->GetTemplateURLService()->search_terms_data(), |
| 372 accepted_suggestion, ShouldAppendExtraParams(result)); | 371 accepted_suggestion, ShouldAppendExtraParams(result)); |
| 373 if (!match.destination_url.is_valid()) | 372 if (!match.destination_url.is_valid()) |
| 374 return; | 373 return; |
| 375 match.search_terms_args->bookmark_bar_pinned = | |
| 376 client_->BookmarkBarIsVisible(); | |
| 377 match.RecordAdditionalInfo(kRelevanceFromServerKey, | 374 match.RecordAdditionalInfo(kRelevanceFromServerKey, |
| 378 result.relevance_from_server() ? kTrue : kFalse); | 375 result.relevance_from_server() ? kTrue : kFalse); |
| 379 match.RecordAdditionalInfo(kShouldPrefetchKey, | 376 match.RecordAdditionalInfo(kShouldPrefetchKey, |
| 380 result.should_prefetch() ? kTrue : kFalse); | 377 result.should_prefetch() ? kTrue : kFalse); |
| 381 SetDeletionURL(result.deletion_url(), &match); | 378 SetDeletionURL(result.deletion_url(), &match); |
| 382 if (mark_as_deletable) | 379 if (mark_as_deletable) |
| 383 match.deletable = true; | 380 match.deletable = true; |
| 384 // Metadata is needed only for prefetching queries. | 381 // Metadata is needed only for prefetching queries. |
| 385 if (result.should_prefetch()) | 382 if (result.should_prefetch()) |
| 386 match.RecordAdditionalInfo(kSuggestMetadataKey, metadata); | 383 match.RecordAdditionalInfo(kSuggestMetadataKey, metadata); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 } | 480 } |
| 484 | 481 |
| 485 void BaseSearchProvider::OnDeletionComplete( | 482 void BaseSearchProvider::OnDeletionComplete( |
| 486 bool success, SuggestionDeletionHandler* handler) { | 483 bool success, SuggestionDeletionHandler* handler) { |
| 487 RecordDeletionResult(success); | 484 RecordDeletionResult(success); |
| 488 SuggestionDeletionHandlers::iterator it = std::find( | 485 SuggestionDeletionHandlers::iterator it = std::find( |
| 489 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 486 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
| 490 DCHECK(it != deletion_handlers_.end()); | 487 DCHECK(it != deletion_handlers_.end()); |
| 491 deletion_handlers_.erase(it); | 488 deletion_handlers_.erase(it); |
| 492 } | 489 } |
| OLD | NEW |