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

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

Issue 8364001: Strip special characters in extension omnibox suggestions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_match.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "chrome/browser/autocomplete/autocomplete.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 old_matches.BuildProviderToMatches(&old_matches_per_provider); 645 old_matches.BuildProviderToMatches(&old_matches_per_provider);
646 for (ProviderToMatches::const_iterator i = old_matches_per_provider.begin(); 646 for (ProviderToMatches::const_iterator i = old_matches_per_provider.begin();
647 i != old_matches_per_provider.end(); ++i) { 647 i != old_matches_per_provider.end(); ++i) {
648 MergeMatchesByProvider(i->second, matches_per_provider[i->first]); 648 MergeMatchesByProvider(i->second, matches_per_provider[i->first]);
649 } 649 }
650 650
651 SortAndCull(input); 651 SortAndCull(input);
652 } 652 }
653 653
654 void AutocompleteResult::AppendMatches(const ACMatches& matches) { 654 void AutocompleteResult::AppendMatches(const ACMatches& matches) {
655 #ifndef NDEBUG
656 for (ACMatches::const_iterator i = matches.begin(); i != matches.end(); ++i) {
657 DCHECK_EQ(AutocompleteMatch::SanitizeString(i->contents), i->contents);
658 DCHECK_EQ(AutocompleteMatch::SanitizeString(i->description),
659 i->description);
660 }
661 #endif
655 std::copy(matches.begin(), matches.end(), std::back_inserter(matches_)); 662 std::copy(matches.begin(), matches.end(), std::back_inserter(matches_));
656 default_match_ = end(); 663 default_match_ = end();
657 alternate_nav_url_ = GURL(); 664 alternate_nav_url_ = GURL();
658 } 665 }
659 666
660 void AutocompleteResult::AddMatch(const AutocompleteMatch& match) { 667 void AutocompleteResult::AddMatch(const AutocompleteMatch& match) {
661 DCHECK(default_match_ != end()); 668 DCHECK(default_match_ != end());
669 DCHECK_EQ(AutocompleteMatch::SanitizeString(match.contents), match.contents);
670 DCHECK_EQ(AutocompleteMatch::SanitizeString(match.description),
671 match.description);
662 ACMatches::iterator insertion_point = 672 ACMatches::iterator insertion_point =
663 std::upper_bound(begin(), end(), match, &AutocompleteMatch::MoreRelevant); 673 std::upper_bound(begin(), end(), match, &AutocompleteMatch::MoreRelevant);
664 ACMatches::iterator::difference_type default_offset = 674 ACMatches::iterator::difference_type default_offset =
665 default_match_ - begin(); 675 default_match_ - begin();
666 if ((insertion_point - begin()) <= default_offset) 676 if ((insertion_point - begin()) <= default_offset)
667 ++default_offset; 677 ++default_offset;
668 matches_.insert(insertion_point, match); 678 matches_.insert(insertion_point, match);
669 default_match_ = begin() + default_offset; 679 default_match_ = begin() + default_offset;
670 } 680 }
671 681
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 } 1053 }
1044 done_ = true; 1054 done_ = true;
1045 } 1055 }
1046 1056
1047 void AutocompleteController::StartExpireTimer() { 1057 void AutocompleteController::StartExpireTimer() {
1048 if (result_.HasCopiedMatches()) 1058 if (result_.HasCopiedMatches())
1049 expire_timer_.Start(FROM_HERE, 1059 expire_timer_.Start(FROM_HERE,
1050 base::TimeDelta::FromMilliseconds(kExpireTimeMS), 1060 base::TimeDelta::FromMilliseconds(kExpireTimeMS),
1051 this, &AutocompleteController::ExpireCopiedEntries); 1061 this, &AutocompleteController::ExpireCopiedEntries);
1052 } 1062 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_match.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698