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

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

Issue 7314018: Don't autocomplete searches of >1 word if they've only been visited once and the user has not yet... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // |destination_url|, we'll use the best match from this provider. 483 // |destination_url|, we'll use the best match from this provider.
484 const AutocompleteProvider* provider_affinity; 484 const AutocompleteProvider* provider_affinity;
485 485
486 // True when this is the HistoryURLProvider's "what you typed" match. This 486 // True when this is the HistoryURLProvider's "what you typed" match. This
487 // can't be tracked using |destination_url| because its URL changes on every 487 // can't be tracked using |destination_url| because its URL changes on every
488 // keystroke, so if this is set, we'll preserve the selection by simply 488 // keystroke, so if this is set, we'll preserve the selection by simply
489 // choosing the new "what you typed" entry and ignoring |destination_url|. 489 // choosing the new "what you typed" entry and ignoring |destination_url|.
490 bool is_history_what_you_typed_match; 490 bool is_history_what_you_typed_match;
491 }; 491 };
492 492
493 // Max number of matches we'll show from the various providers.
494 static const size_t kMaxMatches;
495
496 // The lowest score a match can have and still potentially become the default
497 // match for the result set.
498 static const int kLowestDefaultScore;
499
493 AutocompleteResult(); 500 AutocompleteResult();
494 ~AutocompleteResult(); 501 ~AutocompleteResult();
495 502
496 // operator=() by another name. 503 // operator=() by another name.
497 void CopyFrom(const AutocompleteResult& rhs); 504 void CopyFrom(const AutocompleteResult& rhs);
498 505
499 // Copies matches from |old_matches| to provide a consistant result set. See 506 // Copies matches from |old_matches| to provide a consistant result set. See
500 // comments in code for specifics. 507 // comments in code for specifics.
501 void CopyOldMatches(const AutocompleteInput& input, 508 void CopyOldMatches(const AutocompleteInput& input,
502 const AutocompleteResult& old_matches); 509 const AutocompleteResult& old_matches);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 // Clears the matches for this result set. 544 // Clears the matches for this result set.
538 void Reset(); 545 void Reset();
539 546
540 void Swap(AutocompleteResult* other); 547 void Swap(AutocompleteResult* other);
541 548
542 #ifndef NDEBUG 549 #ifndef NDEBUG
543 // Does a data integrity check on this result. 550 // Does a data integrity check on this result.
544 void Validate() const; 551 void Validate() const;
545 #endif 552 #endif
546 553
547 // Max number of matches we'll show from the various providers.
548 static const size_t kMaxMatches;
549
550 private: 554 private:
551 typedef std::map<AutocompleteProvider*, ACMatches> ProviderToMatches; 555 typedef std::map<AutocompleteProvider*, ACMatches> ProviderToMatches;
552 556
553 // Populates |provider_to_matches| from |matches_|. 557 // Populates |provider_to_matches| from |matches_|.
554 void BuildProviderToMatches(ProviderToMatches* provider_to_matches) const; 558 void BuildProviderToMatches(ProviderToMatches* provider_to_matches) const;
555 559
556 // Returns true if |matches| contains a match with the same destination as 560 // Returns true if |matches| contains a match with the same destination as
557 // |match|. 561 // |match|.
558 static bool HasMatchByDestination(const AutocompleteMatch& match, 562 static bool HasMatchByDestination(const AutocompleteMatch& match,
559 const ACMatches& matches); 563 const ACMatches& matches);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 AutocompleteInput::Type input_type; 753 AutocompleteInput::Type input_type;
750 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). 754 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch).
751 size_t selected_index; 755 size_t selected_index;
752 // Inline autocompleted length (if displayed). 756 // Inline autocompleted length (if displayed).
753 size_t inline_autocompleted_length; 757 size_t inline_autocompleted_length;
754 // Result set. 758 // Result set.
755 const AutocompleteResult& result; 759 const AutocompleteResult& result;
756 }; 760 };
757 761
758 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ 762 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete.cc » ('j') | chrome/browser/autocomplete/shortcuts_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698