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

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

Issue 6731036: Enabled pressing TAB to cycle through the Omnibox results. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Enabled pressing TAB to cycle through the Omnibox results, removed moving the caret to the Created 9 years, 8 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) 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 std::upper_bound(begin(), end(), match, &AutocompleteMatch::MoreRelevant); 634 std::upper_bound(begin(), end(), match, &AutocompleteMatch::MoreRelevant);
635 ACMatches::iterator::difference_type default_offset = 635 ACMatches::iterator::difference_type default_offset =
636 default_match_ - begin(); 636 default_match_ - begin();
637 if ((insertion_point - begin()) <= default_offset) 637 if ((insertion_point - begin()) <= default_offset)
638 ++default_offset; 638 ++default_offset;
639 matches_.insert(insertion_point, match); 639 matches_.insert(insertion_point, match);
640 default_match_ = begin() + default_offset; 640 default_match_ = begin() + default_offset;
641 } 641 }
642 642
643 void AutocompleteResult::SortAndCull(const AutocompleteInput& input) { 643 void AutocompleteResult::SortAndCull(const AutocompleteInput& input) {
644 // Normalize destination URLs
Peter Kasting 2011/04/01 00:09:09 Nit: This comment adds nothing, just eliminate it.
645 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) {
Peter Kasting 2011/04/01 00:09:09 Nit: No {}
646 i->NormalizeDestination();
647 }
648
644 // Remove duplicates. 649 // Remove duplicates.
645 std::sort(matches_.begin(), matches_.end(), 650 std::sort(matches_.begin(), matches_.end(),
646 &AutocompleteMatch::DestinationSortFunc); 651 &AutocompleteMatch::NormalizedSortFunc);
647 matches_.erase(std::unique(matches_.begin(), matches_.end(), 652 matches_.erase(std::unique(matches_.begin(), matches_.end(),
648 &AutocompleteMatch::DestinationsEqual), 653 &AutocompleteMatch::NormalizedEqual),
649 matches_.end()); 654 matches_.end());
650 655
651 // Sort and trim to the most relevant kMaxMatches matches. 656 // Sort and trim to the most relevant kMaxMatches matches.
652 const size_t num_matches = std::min(kMaxMatches, matches_.size()); 657 const size_t num_matches = std::min(kMaxMatches, matches_.size());
653 std::partial_sort(matches_.begin(), matches_.begin() + num_matches, 658 std::partial_sort(matches_.begin(), matches_.begin() + num_matches,
654 matches_.end(), &AutocompleteMatch::MoreRelevant); 659 matches_.end(), &AutocompleteMatch::MoreRelevant);
655 matches_.resize(num_matches); 660 matches_.resize(num_matches);
656 661
657 default_match_ = begin(); 662 default_match_ = begin();
658 663
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 } 986 }
982 } 987 }
983 done_ = true; 988 done_ = true;
984 } 989 }
985 990
986 void AutocompleteController::StartExpireTimer() { 991 void AutocompleteController::StartExpireTimer() {
987 if (result_.HasCopiedMatches()) 992 if (result_.HasCopiedMatches())
988 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS), 993 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS),
989 this, &AutocompleteController::ExpireCopiedEntries); 994 this, &AutocompleteController::ExpireCopiedEntries);
990 } 995 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698