Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_controller.cc

Issue 399063002: Remove BaseSearchProvider::set_in_app_list (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/autocomplete_controller.h" 5 #include "chrome/browser/autocomplete/autocomplete_controller.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // add for every provider. 382 // add for every provider.
383 } 383 }
384 } 384 }
385 385
386 void AutocompleteController::ResetSession() { 386 void AutocompleteController::ResetSession() {
387 for (Providers::const_iterator i(providers_.begin()); i != providers_.end(); 387 for (Providers::const_iterator i(providers_.begin()); i != providers_.end();
388 ++i) 388 ++i)
389 (*i)->ResetSession(); 389 (*i)->ResetSession();
390 } 390 }
391 391
392 void AutocompleteController::UpdateMatchDestinationURL( 392 void AutocompleteController::UpdateMatchDestinationURLWithQueryFormulationTime(
393 base::TimeDelta query_formulation_time, 393 base::TimeDelta query_formulation_time,
394 AutocompleteMatch* match) const { 394 AutocompleteMatch* match) const {
395 TemplateURL* template_url = match->GetTemplateURL( 395 if (!match->search_terms_args.get() ||
396 template_url_service_, false);
397 if (!template_url || !match->search_terms_args.get() ||
398 match->search_terms_args->assisted_query_stats.empty()) 396 match->search_terms_args->assisted_query_stats.empty())
399 return; 397 return;
400 398
401 // Append the query formulation time (time from when the user first typed a 399 // Append the query formulation time (time from when the user first typed a
402 // character into the omnibox to when the user selected a query) and whether 400 // character into the omnibox to when the user selected a query) and whether
403 // a field trial has triggered to the AQS parameter. 401 // a field trial has triggered to the AQS parameter.
404 TemplateURLRef::SearchTermsArgs search_terms_args(*match->search_terms_args); 402 TemplateURLRef::SearchTermsArgs search_terms_args(*match->search_terms_args);
405 search_terms_args.assisted_query_stats += base::StringPrintf( 403 search_terms_args.assisted_query_stats += base::StringPrintf(
406 ".%" PRId64 "j%dj%d", 404 ".%" PRId64 "j%dj%d",
407 query_formulation_time.InMilliseconds(), 405 query_formulation_time.InMilliseconds(),
408 (search_provider_ && 406 (search_provider_ &&
409 search_provider_->field_trial_triggered_in_session()) || 407 search_provider_->field_trial_triggered_in_session()) ||
410 (zero_suggest_provider_ && 408 (zero_suggest_provider_ &&
411 zero_suggest_provider_->field_trial_triggered_in_session()), 409 zero_suggest_provider_->field_trial_triggered_in_session()),
412 input_.current_page_classification()); 410 input_.current_page_classification());
411 UpdateMatchDestinationURL(search_terms_args, match);
412 }
413
414 void AutocompleteController::UpdateMatchDestinationURL(
415 const TemplateURLRef::SearchTermsArgs& search_terms_args,
416 AutocompleteMatch* match) const {
417 TemplateURL* template_url = match->GetTemplateURL(
418 template_url_service_, false);
419 if (!template_url)
420 return;
421
413 match->destination_url = GURL(template_url->url_ref().ReplaceSearchTerms( 422 match->destination_url = GURL(template_url->url_ref().ReplaceSearchTerms(
414 search_terms_args, template_url_service_->search_terms_data())); 423 search_terms_args, template_url_service_->search_terms_data()));
415 } 424 }
416 425
417 void AutocompleteController::UpdateResult( 426 void AutocompleteController::UpdateResult(
418 bool regenerate_result, 427 bool regenerate_result,
419 bool force_notify_default_match_changed) { 428 bool force_notify_default_match_changed) {
420 const bool last_default_was_valid = result_.default_match() != result_.end(); 429 const bool last_default_was_valid = result_.default_match() != result_.end();
421 // The following three variables are only set and used if 430 // The following three variables are only set and used if
422 // |last_default_was_valid|. 431 // |last_default_was_valid|.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 this, &AutocompleteController::ExpireCopiedEntries); 648 this, &AutocompleteController::ExpireCopiedEntries);
640 } 649 }
641 650
642 void AutocompleteController::StartStopTimer() { 651 void AutocompleteController::StartStopTimer() {
643 stop_timer_.Start(FROM_HERE, 652 stop_timer_.Start(FROM_HERE,
644 stop_timer_duration_, 653 stop_timer_duration_,
645 base::Bind(&AutocompleteController::Stop, 654 base::Bind(&AutocompleteController::Stop,
646 base::Unretained(this), 655 base::Unretained(this),
647 false)); 656 false));
648 } 657 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_controller.h ('k') | chrome/browser/autocomplete/autocomplete_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698