autocomplete_controller.cc revision effb81e5f8246d0db0270817048dc992db66e9fb
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 3// found in the LICENSE file. 4 5#include "chrome/browser/autocomplete/autocomplete_controller.h" 6 7#include <set> 8#include <string> 9 10#include "base/format_macros.h" 11#include "base/logging.h" 12#include "base/metrics/histogram.h" 13#include "base/strings/string_number_conversions.h" 14#include "base/strings/stringprintf.h" 15#include "base/time/time.h" 16#include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" 17#include "chrome/browser/autocomplete/bookmark_provider.h" 18#include "chrome/browser/autocomplete/builtin_provider.h" 19#include "chrome/browser/autocomplete/extension_app_provider.h" 20#include "chrome/browser/autocomplete/history_quick_provider.h" 21#include "chrome/browser/autocomplete/history_url_provider.h" 22#include "chrome/browser/autocomplete/keyword_provider.h" 23#include "chrome/browser/autocomplete/search_provider.h" 24#include "chrome/browser/autocomplete/shortcuts_provider.h" 25#include "chrome/browser/autocomplete/zero_suggest_provider.h" 26#include "chrome/browser/chrome_notification_types.h" 27#include "chrome/browser/omnibox/omnibox_field_trial.h" 28#include "chrome/browser/profiles/profile.h" 29#include "chrome/browser/search/search.h" 30#include "chrome/browser/search_engines/template_url.h" 31#include "content/public/browser/notification_service.h" 32#include "grit/generated_resources.h" 33#include "grit/theme_resources.h" 34#include "ui/base/l10n/l10n_util.h" 35 36namespace { 37 38// Converts the given match to a type (and possibly subtype) based on the AQS 39// specification. For more details, see 40// http://goto.google.com/binary-clients-logging. 41void AutocompleteMatchToAssistedQuery( 42 const AutocompleteMatch::Type& match, size_t* type, size_t* subtype) { 43 // This type indicates a native chrome suggestion. 44 *type = 69; 45 // Default value, indicating no subtype. 46 *subtype = base::string16::npos; 47 48 switch (match) { 49 case AutocompleteMatchType::SEARCH_SUGGEST: { 50 *type = 0; 51 return; 52 } 53 case AutocompleteMatchType::SEARCH_SUGGEST_ENTITY: { 54 *subtype = 46; 55 return; 56 } 57 case AutocompleteMatchType::SEARCH_SUGGEST_INFINITE: { 58 *subtype = 33; 59 return; 60 } 61 case AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED: { 62 *subtype = 35; 63 return; 64 } 65 case AutocompleteMatchType::SEARCH_SUGGEST_PROFILE: { 66 *subtype = 44; 67 return; 68 } 69 case AutocompleteMatchType::NAVSUGGEST: { 70 *type = 5; 71 return; 72 } 73 case AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED: { 74 *subtype = 57; 75 return; 76 } 77 case AutocompleteMatchType::URL_WHAT_YOU_TYPED: { 78 *subtype = 58; 79 return; 80 } 81 case AutocompleteMatchType::SEARCH_HISTORY: { 82 *subtype = 59; 83 return; 84 } 85 case AutocompleteMatchType::HISTORY_URL: { 86 *subtype = 60; 87 return; 88 } 89 case AutocompleteMatchType::HISTORY_TITLE: { 90 *subtype = 61; 91 return; 92 } 93 case AutocompleteMatchType::HISTORY_BODY: { 94 *subtype = 62; 95 return; 96 } 97 case AutocompleteMatchType::HISTORY_KEYWORD: { 98 *subtype = 63; 99 return; 100 } 101 case AutocompleteMatchType::BOOKMARK_TITLE: { 102 *subtype = 65; 103 return; 104 } 105 default: { 106 // This value indicates a native chrome suggestion with no named subtype 107 // (yet). 108 *subtype = 64; 109 } 110 } 111} 112 113// Appends available autocompletion of the given type, subtype, and number to 114// the existing available autocompletions string, encoding according to the 115// spec. 116void AppendAvailableAutocompletion(size_t type, 117 size_t subtype, 118 int count, 119 std::string* autocompletions) { 120 if (!autocompletions->empty()) 121 autocompletions->append("j"); 122 base::StringAppendF(autocompletions, "%" PRIuS, type); 123 // Subtype is optional - base::string16::npos indicates no subtype. 124 if (subtype != base::string16::npos) 125 base::StringAppendF(autocompletions, "i%" PRIuS, subtype); 126 if (count > 1) 127 base::StringAppendF(autocompletions, "l%d", count); 128} 129 130// Returns whether the autocompletion is trivial enough that we consider it 131// an autocompletion for which the omnibox autocompletion code did not add 132// any value. 133bool IsTrivialAutocompletion(const AutocompleteMatch& match) { 134 return match.type == AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED || 135 match.type == AutocompleteMatchType::URL_WHAT_YOU_TYPED || 136 match.type == AutocompleteMatchType::SEARCH_OTHER_ENGINE; 137} 138 139// Whether this autocomplete match type supports custom descriptions. 140bool AutocompleteMatchHasCustomDescription(const AutocompleteMatch& match) { 141 return match.type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY || 142 match.type == AutocompleteMatchType::SEARCH_SUGGEST_PROFILE; 143} 144 145} // namespace 146 147AutocompleteController::AutocompleteController( 148 Profile* profile, 149 AutocompleteControllerDelegate* delegate, 150 int provider_types) 151 : delegate_(delegate), 152 history_url_provider_(NULL), 153 keyword_provider_(NULL), 154 search_provider_(NULL), 155 zero_suggest_provider_(NULL), 156 stop_timer_duration_(OmniboxFieldTrial::StopTimerFieldTrialDuration()), 157 done_(true), 158 in_start_(false), 159 profile_(profile) { 160 provider_types &= ~OmniboxFieldTrial::GetDisabledProviderTypes(); 161 if (provider_types & AutocompleteProvider::TYPE_BOOKMARK) 162 providers_.push_back(new BookmarkProvider(this, profile)); 163 if (provider_types & AutocompleteProvider::TYPE_BUILTIN) 164 providers_.push_back(new BuiltinProvider(this, profile)); 165 if (provider_types & AutocompleteProvider::TYPE_EXTENSION_APP) 166 providers_.push_back(new ExtensionAppProvider(this, profile)); 167 if (provider_types & AutocompleteProvider::TYPE_HISTORY_QUICK) 168 providers_.push_back(new HistoryQuickProvider(this, profile)); 169 if (provider_types & AutocompleteProvider::TYPE_HISTORY_URL) { 170 history_url_provider_ = new HistoryURLProvider(this, profile); 171 providers_.push_back(history_url_provider_); 172 } 173 // "Tab to search" can be used on all platforms other than Android. 174#if !defined(OS_ANDROID) 175 if (provider_types & AutocompleteProvider::TYPE_KEYWORD) { 176 keyword_provider_ = new KeywordProvider(this, profile); 177 providers_.push_back(keyword_provider_); 178 } 179#endif 180 if (provider_types & AutocompleteProvider::TYPE_SEARCH) { 181 search_provider_ = new SearchProvider(this, profile); 182 providers_.push_back(search_provider_); 183 } 184 if (provider_types & AutocompleteProvider::TYPE_SHORTCUTS) 185 providers_.push_back(new ShortcutsProvider(this, profile)); 186 if (provider_types & AutocompleteProvider::TYPE_ZERO_SUGGEST) { 187 zero_suggest_provider_ = ZeroSuggestProvider::Create(this, profile); 188 if (zero_suggest_provider_) 189 providers_.push_back(zero_suggest_provider_); 190 } 191 192 for (ACProviders::iterator i(providers_.begin()); i != providers_.end(); ++i) 193 (*i)->AddRef(); 194} 195 196AutocompleteController::~AutocompleteController() { 197 // The providers may have tasks outstanding that hold refs to them. We need 198 // to ensure they won't call us back if they outlive us. (Practically, 199 // calling Stop() should also cancel those tasks and make it so that we hold 200 // the only refs.) We also don't want to bother notifying anyone of our 201 // result changes here, because the notification observer is in the midst of 202 // shutdown too, so we don't ask Stop() to clear |result_| (and notify). 203 result_.Reset(); // Not really necessary. 204 Stop(false); 205 206 for (ACProviders::iterator i(providers_.begin()); i != providers_.end(); ++i) 207 (*i)->Release(); 208 209 providers_.clear(); // Not really necessary. 210} 211 212void AutocompleteController::Start(const AutocompleteInput& input) { 213 const base::string16 old_input_text(input_.text()); 214 const AutocompleteInput::MatchesRequested old_matches_requested = 215 input_.matches_requested(); 216 input_ = input; 217 218 // See if we can avoid rerunning autocomplete when the query hasn't changed 219 // much. When the user presses or releases the ctrl key, the desired_tld 220 // changes, and when the user finishes an IME composition, inline autocomplete 221 // may no longer be prevented. In both these cases the text itself hasn't 222 // changed since the last query, and some providers can do much less work (and 223 // get matches back more quickly). Taking advantage of this reduces flicker. 224 // 225 // NOTE: This comes after constructing |input_| above since that construction 226 // can change the text string (e.g. by stripping off a leading '?'). 227 const bool minimal_changes = (input_.text() == old_input_text) && 228 (input_.matches_requested() == old_matches_requested); 229 230 expire_timer_.Stop(); 231 stop_timer_.Stop(); 232 233 // Start the new query. 234 in_start_ = true; 235 base::TimeTicks start_time = base::TimeTicks::Now(); 236 for (ACProviders::iterator i(providers_.begin()); i != providers_.end(); 237 ++i) { 238 // TODO(mpearson): Remove timing code once bugs 178705 / 237703 / 168933 239 // are resolved. 240 base::TimeTicks provider_start_time = base::TimeTicks::Now(); 241 242 // Call Start() on ZeroSuggestProvider with an INVALID AutocompleteInput 243 // to clear out zero-suggest |matches_|. 244 if (*i == zero_suggest_provider_) 245 (*i)->Start(AutocompleteInput(), minimal_changes); 246 else 247 (*i)->Start(input_, minimal_changes); 248 249 if (input.matches_requested() != AutocompleteInput::ALL_MATCHES) 250 DCHECK((*i)->done()); 251 base::TimeTicks provider_end_time = base::TimeTicks::Now(); 252 std::string name = std::string("Omnibox.ProviderTime.") + (*i)->GetName(); 253 base::HistogramBase* counter = base::Histogram::FactoryGet( 254 name, 1, 5000, 20, base::Histogram::kUmaTargetedHistogramFlag); 255 counter->Add(static_cast<int>( 256 (provider_end_time - provider_start_time).InMilliseconds())); 257 } 258 if (input.matches_requested() == AutocompleteInput::ALL_MATCHES && 259 (input.text().length() < 6)) { 260 base::TimeTicks end_time = base::TimeTicks::Now(); 261 std::string name = "Omnibox.QueryTime." + base::IntToString( 262 input.text().length()); 263 base::HistogramBase* counter = base::Histogram::FactoryGet( 264 name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag); 265 counter->Add(static_cast<int>((end_time - start_time).InMilliseconds())); 266 } 267 in_start_ = false; 268 CheckIfDone(); 269 // The second true forces saying the default match has changed. 270 // This triggers the edit model to update things such as the inline 271 // autocomplete state. In particular, if the user has typed a key 272 // since the last notification, and we're now re-running 273 // autocomplete, then we need to update the inline autocompletion 274 // even if the current match is for the same URL as the last run's 275 // default match. Likewise, the controller doesn't know what's 276 // happened in the edit since the last time it ran autocomplete. 277 // The user might have selected all the text and hit delete, then 278 // typed a new character. The selection and delete won't send any 279 // signals to the controller so it doesn't realize that anything was 280 // cleared or changed. Even if the default match hasn't changed, we 281 // need the edit model to update the display. 282 UpdateResult(false, true); 283 284 if (!done_) { 285 StartExpireTimer(); 286 StartStopTimer(); 287 } 288} 289 290void AutocompleteController::Stop(bool clear_result) { 291 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); 292 ++i) { 293 (*i)->Stop(clear_result); 294 } 295 296 expire_timer_.Stop(); 297 stop_timer_.Stop(); 298 done_ = true; 299 if (clear_result && !result_.empty()) { 300 result_.Reset(); 301 // NOTE: We pass in false since we're trying to only clear the popup, not 302 // touch the edit... this is all a mess and should be cleaned up :( 303 NotifyChanged(false); 304 } 305} 306 307void AutocompleteController::StartZeroSuggest(const AutocompleteInput& input) { 308 if (zero_suggest_provider_ != NULL) { 309 DCHECK(!in_start_); // We should not be already running a query. 310 311 // Call Start() on all prefix-based providers with an INVALID 312 // AutocompleteInput to clear out cached |matches_|, which ensures that 313 // they aren't used with zero suggest. 314 for (ACProviders::iterator i(providers_.begin()); i != providers_.end(); 315 ++i) { 316 if (*i == zero_suggest_provider_) 317 (*i)->Start(input, false); 318 else 319 (*i)->Start(AutocompleteInput(), false); 320 } 321 } 322} 323 324void AutocompleteController::DeleteMatch(const AutocompleteMatch& match) { 325 DCHECK(match.SupportsDeletion()); 326 327 // Delete duplicate matches attached to the main match first. 328 for (ACMatches::const_iterator it(match.duplicate_matches.begin()); 329 it != match.duplicate_matches.end(); ++it) { 330 if (it->deletable) 331 it->provider->DeleteMatch(*it); 332 } 333 334 if (match.deletable) 335 match.provider->DeleteMatch(match); 336 337 OnProviderUpdate(true); 338 339 // If we're not done, we might attempt to redisplay the deleted match. Make 340 // sure we aren't displaying it by removing any old entries. 341 ExpireCopiedEntries(); 342} 343 344void AutocompleteController::ExpireCopiedEntries() { 345 // The first true makes UpdateResult() clear out the results and 346 // regenerate them, thus ensuring that no results from the previous 347 // result set remain. 348 UpdateResult(true, false); 349} 350 351void AutocompleteController::OnProviderUpdate(bool updated_matches) { 352 CheckIfDone(); 353 // Multiple providers may provide synchronous results, so we only update the 354 // results if we're not in Start(). 355 if (!in_start_ && (updated_matches || done_)) 356 UpdateResult(false, false); 357} 358 359void AutocompleteController::AddProvidersInfo( 360 ProvidersInfo* provider_info) const { 361 provider_info->clear(); 362 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); 363 ++i) { 364 // Add per-provider info, if any. 365 (*i)->AddProviderInfo(provider_info); 366 367 // This is also a good place to put code to add info that you want to 368 // add for every provider. 369 } 370} 371 372void AutocompleteController::ResetSession() { 373 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); 374 ++i) 375 (*i)->ResetSession(); 376} 377 378void AutocompleteController::UpdateMatchDestinationURL( 379 base::TimeDelta query_formulation_time, 380 AutocompleteMatch* match) const { 381 TemplateURL* template_url = match->GetTemplateURL(profile_, false); 382 if (!template_url || !match->search_terms_args.get() || 383 match->search_terms_args->assisted_query_stats.empty()) 384 return; 385 386 // Append the query formulation time (time from when the user first typed a 387 // character into the omnibox to when the user selected a query) and whether 388 // a field trial has triggered to the AQS parameter. 389 TemplateURLRef::SearchTermsArgs search_terms_args(*match->search_terms_args); 390 search_terms_args.assisted_query_stats += base::StringPrintf( 391 ".%" PRId64 "j%dj%d", 392 query_formulation_time.InMilliseconds(), 393 (search_provider_ && 394 search_provider_->field_trial_triggered_in_session()) || 395 (zero_suggest_provider_ && 396 zero_suggest_provider_->field_trial_triggered_in_session()), 397 input_.current_page_classification()); 398 match->destination_url = 399 GURL(template_url->url_ref().ReplaceSearchTerms(search_terms_args)); 400} 401 402void AutocompleteController::UpdateResult( 403 bool regenerate_result, 404 bool force_notify_default_match_changed) { 405 const bool last_default_was_valid = result_.default_match() != result_.end(); 406 // The following three variables are only set and used if 407 // |last_default_was_valid|. 408 base::string16 last_default_fill_into_edit, last_default_keyword, 409 last_default_associated_keyword; 410 if (last_default_was_valid) { 411 last_default_fill_into_edit = result_.default_match()->fill_into_edit; 412 last_default_keyword = result_.default_match()->keyword; 413 if (result_.default_match()->associated_keyword != NULL) 414 last_default_associated_keyword = 415 result_.default_match()->associated_keyword->keyword; 416 } 417 418 if (regenerate_result) 419 result_.Reset(); 420 421 AutocompleteResult last_result; 422 last_result.Swap(&result_); 423 424 for (ACProviders::const_iterator i(providers_.begin()); 425 i != providers_.end(); ++i) 426 result_.AppendMatches((*i)->matches()); 427 428 // Sort the matches and trim to a small number of "best" matches. 429 result_.SortAndCull(input_, profile_); 430 431 // Need to validate before invoking CopyOldMatches as the old matches are not 432 // valid against the current input. 433#ifndef NDEBUG 434 result_.Validate(); 435#endif 436 437 if (!done_) { 438 // This conditional needs to match the conditional in Start that invokes 439 // StartExpireTimer. 440 result_.CopyOldMatches(input_, last_result, profile_); 441 } 442 443 UpdateKeywordDescriptions(&result_); 444 UpdateAssociatedKeywords(&result_); 445 UpdateAssistedQueryStats(&result_); 446 447 const bool default_is_valid = result_.default_match() != result_.end(); 448 base::string16 default_associated_keyword; 449 if (default_is_valid && 450 (result_.default_match()->associated_keyword != NULL)) { 451 default_associated_keyword = 452 result_.default_match()->associated_keyword->keyword; 453 } 454 // We've gotten async results. Send notification that the default match 455 // updated if fill_into_edit, associated_keyword, or keyword differ. (The 456 // second can change if we've just started Chrome and the keyword database 457 // finishes loading while processing this request. The third can change 458 // if we swapped from interpreting the input as a search--which gets 459 // labeled with the default search provider's keyword--to a URL.) 460 // We don't check the URL as that may change for the default match 461 // even though the fill into edit hasn't changed (see SearchProvider 462 // for one case of this). 463 const bool notify_default_match = 464 (last_default_was_valid != default_is_valid) || 465 (last_default_was_valid && 466 ((result_.default_match()->fill_into_edit != 467 last_default_fill_into_edit) || 468 (default_associated_keyword != last_default_associated_keyword) || 469 (result_.default_match()->keyword != last_default_keyword))); 470 if (notify_default_match) 471 last_time_default_match_changed_ = base::TimeTicks::Now(); 472 473 NotifyChanged(force_notify_default_match_changed || notify_default_match); 474} 475 476void AutocompleteController::UpdateAssociatedKeywords( 477 AutocompleteResult* result) { 478 if (!keyword_provider_) 479 return; 480 481 std::set<base::string16> keywords; 482 for (ACMatches::iterator match(result->begin()); match != result->end(); 483 ++match) { 484 base::string16 keyword( 485 match->GetSubstitutingExplicitlyInvokedKeyword(profile_)); 486 if (!keyword.empty()) { 487 keywords.insert(keyword); 488 continue; 489 } 490 491 // Only add the keyword if the match does not have a duplicate keyword with 492 // a more relevant match. 493 keyword = match->associated_keyword.get() ? 494 match->associated_keyword->keyword : 495 keyword_provider_->GetKeywordForText(match->fill_into_edit); 496 if (!keyword.empty() && !keywords.count(keyword)) { 497 keywords.insert(keyword); 498 499 if (!match->associated_keyword.get()) 500 match->associated_keyword.reset(new AutocompleteMatch( 501 keyword_provider_->CreateVerbatimMatch(match->fill_into_edit, 502 keyword, input_))); 503 } else { 504 match->associated_keyword.reset(); 505 } 506 } 507} 508 509void AutocompleteController::UpdateKeywordDescriptions( 510 AutocompleteResult* result) { 511 base::string16 last_keyword; 512 for (AutocompleteResult::iterator i(result->begin()); i != result->end(); 513 ++i) { 514 if (AutocompleteMatch::IsSearchType(i->type)) { 515 if (AutocompleteMatchHasCustomDescription(*i)) 516 continue; 517 i->description.clear(); 518 i->description_class.clear(); 519 DCHECK(!i->keyword.empty()); 520 if (i->keyword != last_keyword) { 521 const TemplateURL* template_url = i->GetTemplateURL(profile_, false); 522 if (template_url) { 523 // For extension keywords, just make the description the extension 524 // name -- don't assume that the normal search keyword description is 525 // applicable. 526 i->description = template_url->AdjustedShortNameForLocaleDirection(); 527 if (template_url->GetType() != TemplateURL::OMNIBOX_API_EXTENSION) { 528 i->description = l10n_util::GetStringFUTF16( 529 IDS_AUTOCOMPLETE_SEARCH_DESCRIPTION, i->description); 530 } 531 i->description_class.push_back( 532 ACMatchClassification(0, ACMatchClassification::DIM)); 533 } 534 last_keyword = i->keyword; 535 } 536 } else { 537 last_keyword.clear(); 538 } 539 } 540} 541 542void AutocompleteController::UpdateAssistedQueryStats( 543 AutocompleteResult* result) { 544 if (result->empty()) 545 return; 546 547 // Build the impressions string (the AQS part after "."). 548 std::string autocompletions; 549 int count = 0; 550 size_t last_type = base::string16::npos; 551 size_t last_subtype = base::string16::npos; 552 for (ACMatches::iterator match(result->begin()); match != result->end(); 553 ++match) { 554 size_t type = base::string16::npos; 555 size_t subtype = base::string16::npos; 556 AutocompleteMatchToAssistedQuery(match->type, &type, &subtype); 557 if (last_type != base::string16::npos && 558 (type != last_type || subtype != last_subtype)) { 559 AppendAvailableAutocompletion( 560 last_type, last_subtype, count, &autocompletions); 561 count = 1; 562 } else { 563 count++; 564 } 565 last_type = type; 566 last_subtype = subtype; 567 } 568 AppendAvailableAutocompletion( 569 last_type, last_subtype, count, &autocompletions); 570 // Go over all matches and set AQS if the match supports it. 571 for (size_t index = 0; index < result->size(); ++index) { 572 AutocompleteMatch* match = result->match_at(index); 573 const TemplateURL* template_url = match->GetTemplateURL(profile_, false); 574 if (!template_url || !match->search_terms_args.get()) 575 continue; 576 std::string selected_index; 577 // Prevent trivial suggestions from getting credit for being selected. 578 if (!IsTrivialAutocompletion(*match)) 579 selected_index = base::StringPrintf("%" PRIuS, index); 580 match->search_terms_args->assisted_query_stats = 581 base::StringPrintf("chrome.%s.%s", 582 selected_index.c_str(), 583 autocompletions.c_str()); 584 match->destination_url = GURL(template_url->url_ref().ReplaceSearchTerms( 585 *match->search_terms_args)); 586 } 587} 588 589void AutocompleteController::NotifyChanged(bool notify_default_match) { 590 if (delegate_) 591 delegate_->OnResultChanged(notify_default_match); 592 if (done_) { 593 content::NotificationService::current()->Notify( 594 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, 595 content::Source<AutocompleteController>(this), 596 content::NotificationService::NoDetails()); 597 } 598} 599 600void AutocompleteController::CheckIfDone() { 601 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); 602 ++i) { 603 if (!(*i)->done()) { 604 done_ = false; 605 return; 606 } 607 } 608 done_ = true; 609} 610 611void AutocompleteController::StartExpireTimer() { 612 // Amount of time (in ms) between when the user stops typing and 613 // when we remove any copied entries. We do this from the time the 614 // user stopped typing as some providers (such as SearchProvider) 615 // wait for the user to stop typing before they initiate a query. 616 const int kExpireTimeMS = 500; 617 618 if (result_.HasCopiedMatches()) 619 expire_timer_.Start(FROM_HERE, 620 base::TimeDelta::FromMilliseconds(kExpireTimeMS), 621 this, &AutocompleteController::ExpireCopiedEntries); 622} 623 624void AutocompleteController::StartStopTimer() { 625 stop_timer_.Start(FROM_HERE, 626 stop_timer_duration_, 627 base::Bind(&AutocompleteController::Stop, 628 base::Unretained(this), 629 false)); 630} 631