OLD | NEW |
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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // Append the query formulation time (time from when the user first typed a | 458 // Append the query formulation time (time from when the user first typed a |
459 // character into the omnibox to when the user selected a query) and whether | 459 // character into the omnibox to when the user selected a query) and whether |
460 // a field trial has triggered to the AQS parameter, if other AQS parameters | 460 // a field trial has triggered to the AQS parameter, if other AQS parameters |
461 // were already populated. | 461 // were already populated. |
462 if (template_url && match.search_terms_args.get() && | 462 if (template_url && match.search_terms_args.get() && |
463 !match.search_terms_args->assisted_query_stats.empty()) { | 463 !match.search_terms_args->assisted_query_stats.empty()) { |
464 TemplateURLRef::SearchTermsArgs search_terms_args(*match.search_terms_args); | 464 TemplateURLRef::SearchTermsArgs search_terms_args(*match.search_terms_args); |
465 search_terms_args.assisted_query_stats += base::StringPrintf( | 465 search_terms_args.assisted_query_stats += base::StringPrintf( |
466 ".%" PRId64 "j%d", | 466 ".%" PRId64 "j%d", |
467 query_formulation_time.InMilliseconds(), | 467 query_formulation_time.InMilliseconds(), |
468 search_provider_->field_trial_triggered_in_session()); | 468 search_provider_ ? |
| 469 search_provider_->field_trial_triggered_in_session() : false); |
469 destination_url = GURL(template_url->url_ref(). | 470 destination_url = GURL(template_url->url_ref(). |
470 ReplaceSearchTerms(search_terms_args)); | 471 ReplaceSearchTerms(search_terms_args)); |
471 } | 472 } |
472 return destination_url; | 473 return destination_url; |
473 } | 474 } |
474 | 475 |
475 void AutocompleteController::UpdateKeywordDescriptions( | 476 void AutocompleteController::UpdateKeywordDescriptions( |
476 AutocompleteResult* result) { | 477 AutocompleteResult* result) { |
477 string16 last_keyword; | 478 string16 last_keyword; |
478 for (AutocompleteResult::iterator i(result->begin()); i != result->end(); | 479 for (AutocompleteResult::iterator i(result->begin()); i != result->end(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 } | 523 } |
523 done_ = true; | 524 done_ = true; |
524 } | 525 } |
525 | 526 |
526 void AutocompleteController::StartExpireTimer() { | 527 void AutocompleteController::StartExpireTimer() { |
527 if (result_.HasCopiedMatches()) | 528 if (result_.HasCopiedMatches()) |
528 expire_timer_.Start(FROM_HERE, | 529 expire_timer_.Start(FROM_HERE, |
529 base::TimeDelta::FromMilliseconds(kExpireTimeMS), | 530 base::TimeDelta::FromMilliseconds(kExpireTimeMS), |
530 this, &AutocompleteController::ExpireCopiedEntries); | 531 this, &AutocompleteController::ExpireCopiedEntries); |
531 } | 532 } |
OLD | NEW |