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

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

Issue 17022004: Replace --google-base-suggest-url and --instant-url with --google-base-url. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 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/command_line.h" 10 #include "base/command_line.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 AutocompleteResult* result) { 457 AutocompleteResult* result) {
458 if (!keyword_provider_) 458 if (!keyword_provider_)
459 return; 459 return;
460 460
461 std::set<string16> keywords; 461 std::set<string16> keywords;
462 for (ACMatches::iterator match(result->begin()); match != result->end(); 462 for (ACMatches::iterator match(result->begin()); match != result->end();
463 ++match) { 463 ++match) {
464 string16 keyword(match->GetSubstitutingExplicitlyInvokedKeyword(profile_)); 464 string16 keyword(match->GetSubstitutingExplicitlyInvokedKeyword(profile_));
465 if (!keyword.empty()) { 465 if (!keyword.empty()) {
466 keywords.insert(keyword); 466 keywords.insert(keyword);
467 continue;
468 }
469 keyword = match->associated_keyword.get() ?
470 match->associated_keyword->keyword :
471 keyword_provider_->GetKeywordForText(match->fill_into_edit);
472
473 // Only add the keyword if the match does not have a duplicate keyword
474 // with a more relevant match.
475 if (!keyword.empty() && !keywords.count(keyword)) {
476 keywords.insert(keyword);
477
478 if (!match->associated_keyword.get())
479 match->associated_keyword.reset(new AutocompleteMatch(
480 keyword_provider_->CreateAutocompleteMatch(match->fill_into_edit,
481 keyword, input_)));
467 } else { 482 } else {
468 string16 keyword = match->associated_keyword.get() ? 483 match->associated_keyword.reset();
469 match->associated_keyword->keyword :
470 keyword_provider_->GetKeywordForText(match->fill_into_edit);
471
472 // Only add the keyword if the match does not have a duplicate keyword
473 // with a more relevant match.
474 if (!keyword.empty() && !keywords.count(keyword)) {
475 keywords.insert(keyword);
476
477 if (!match->associated_keyword.get())
478 match->associated_keyword.reset(new AutocompleteMatch(
479 keyword_provider_->CreateAutocompleteMatch(match->fill_into_edit,
480 keyword, input_)));
481 } else {
482 match->associated_keyword.reset();
483 }
484 } 484 }
485 } 485 }
486 } 486 }
487 487
488 void AutocompleteController::UpdateAssistedQueryStats( 488 void AutocompleteController::UpdateAssistedQueryStats(
489 AutocompleteResult* result) { 489 AutocompleteResult* result) {
490 if (result->empty()) 490 if (result->empty())
491 return; 491 return;
492 492
493 // Build the impressions string (the AQS part after "."). 493 // Build the impressions string (the AQS part after ".").
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 !chrome::IsInstantEnabled(profile_)) 646 !chrome::IsInstantEnabled(profile_))
647 #endif 647 #endif
648 { 648 {
649 stop_timer_.Start(FROM_HERE, 649 stop_timer_.Start(FROM_HERE,
650 base::TimeDelta::FromMilliseconds(kStopTimeMS), 650 base::TimeDelta::FromMilliseconds(kStopTimeMS),
651 base::Bind(&AutocompleteController::Stop, 651 base::Bind(&AutocompleteController::Stop,
652 base::Unretained(this), 652 base::Unretained(this),
653 false)); 653 false));
654 } 654 }
655 } 655 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698