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

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

Issue 6268005: Removes the link in the omnibox for searching history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test Created 9 years, 11 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
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/autocomplete/autocomplete.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 GURL alternate_nav_url() const { return alternate_nav_url_; } 497 GURL alternate_nav_url() const { return alternate_nav_url_; }
498 498
499 // Clears the matches for this result set. 499 // Clears the matches for this result set.
500 void Reset(); 500 void Reset();
501 501
502 #ifndef NDEBUG 502 #ifndef NDEBUG
503 // Does a data integrity check on this result. 503 // Does a data integrity check on this result.
504 void Validate() const; 504 void Validate() const;
505 #endif 505 #endif
506 506
507 // Max number of matches we'll show from the various providers. We may end 507 // Max number of matches we'll show from the various providers.
508 // up showing an additional shortcut for Destinations->History, see
509 // AddHistoryContentsShortcut.
510 static const size_t kMaxMatches; 508 static const size_t kMaxMatches;
511 509
512 private: 510 private:
513 ACMatches matches_; 511 ACMatches matches_;
514 512
515 const_iterator default_match_; 513 const_iterator default_match_;
516 514
517 // The "alternate navigation URL", if any, for this result set. This is a URL 515 // The "alternate navigation URL", if any, for this result set. This is a URL
518 // to try offering as a navigational option in case the user navigated to the 516 // to try offering as a navigational option in case the user navigated to the
519 // URL of the default match but intended something else. For example, if the 517 // URL of the default match but intended something else. For example, if the
(...skipping 16 matching lines...) Expand all
536 static const int kNoItemSelected; 534 static const int kNoItemSelected;
537 535
538 // Normally, you will call the first constructor. Unit tests can use the 536 // Normally, you will call the first constructor. Unit tests can use the
539 // second to set the providers to some known testing providers. The default 537 // second to set the providers to some known testing providers. The default
540 // providers will be overridden and the controller will take ownership of the 538 // providers will be overridden and the controller will take ownership of the
541 // providers, Release()ing them on destruction. 539 // providers, Release()ing them on destruction.
542 explicit AutocompleteController(Profile* profile); 540 explicit AutocompleteController(Profile* profile);
543 #ifdef UNIT_TEST 541 #ifdef UNIT_TEST
544 explicit AutocompleteController(const ACProviders& providers) 542 explicit AutocompleteController(const ACProviders& providers)
545 : providers_(providers), 543 : providers_(providers),
546 history_contents_provider_(NULL),
547 search_provider_(NULL), 544 search_provider_(NULL),
548 updated_latest_result_(false), 545 updated_latest_result_(false),
549 delay_interval_has_passed_(false), 546 delay_interval_has_passed_(false),
550 have_committed_during_this_query_(false), 547 have_committed_during_this_query_(false),
551 done_(true) { 548 done_(true) {
552 } 549 }
553 #endif 550 #endif
554 ~AutocompleteController(); 551 ~AutocompleteController();
555 552
556 // Invoked when the profile changes. This forwards the call down to all 553 // Invoked when the profile changes. This forwards the call down to all
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 void DelayTimerFired(); 632 void DelayTimerFired();
636 633
637 // Copies |latest_result_| to |result_| and notifies observers of updates. 634 // Copies |latest_result_| to |result_| and notifies observers of updates.
638 // |notify_default_match| should normally be true; if it's false, we don't 635 // |notify_default_match| should normally be true; if it's false, we don't
639 // send an AUTOCOMPLETE_CONTROLLER_DEFAULT_MATCH_UPDATED notification. This 636 // send an AUTOCOMPLETE_CONTROLLER_DEFAULT_MATCH_UPDATED notification. This
640 // is a hack to avoid updating the edit with out-of-date data. 637 // is a hack to avoid updating the edit with out-of-date data.
641 // TODO(pkasting): Don't hardcode assumptions about who listens to these 638 // TODO(pkasting): Don't hardcode assumptions about who listens to these
642 // notificiations. 639 // notificiations.
643 void CommitResult(bool notify_default_match); 640 void CommitResult(bool notify_default_match);
644 641
645 // Returns the matches from |provider| whose destination urls are not in
646 // |latest_result_|.
647 ACMatches GetMatchesNotInLatestResult(
648 const AutocompleteProvider* provider) const;
649
650 // If the HistoryContentsAutocomplete provider is done and there are more
651 // matches in the database than currently shown, an entry is added to
652 // |latest_result_| to show all history matches.
653 void AddHistoryContentsShortcut();
654
655 // Updates |done_| to be accurate with respect to current providers' statuses. 642 // Updates |done_| to be accurate with respect to current providers' statuses.
656 void CheckIfDone(); 643 void CheckIfDone();
657 644
658 // A list of all providers. 645 // A list of all providers.
659 ACProviders providers_; 646 ACProviders providers_;
660 647
661 HistoryContentsProvider* history_contents_provider_;
662
663 SearchProvider* search_provider_; 648 SearchProvider* search_provider_;
664 649
665 // Input passed to Start. 650 // Input passed to Start.
666 AutocompleteInput input_; 651 AutocompleteInput input_;
667 652
668 // Data from the autocomplete query. 653 // Data from the autocomplete query.
669 AutocompleteResult result_; 654 AutocompleteResult result_;
670 655
671 // The latest result available from the autocomplete providers. This may be 656 // The latest result available from the autocomplete providers. This may be
672 // different than |result_| if we've gotten matches from our providers that we 657 // different than |result_| if we've gotten matches from our providers that we
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 AutocompleteInput::Type input_type; 716 AutocompleteInput::Type input_type;
732 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). 717 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch).
733 size_t selected_index; 718 size_t selected_index;
734 // Inline autocompleted length (if displayed). 719 // Inline autocompleted length (if displayed).
735 size_t inline_autocompleted_length; 720 size_t inline_autocompleted_length;
736 // Result set. 721 // Result set.
737 const AutocompleteResult& result; 722 const AutocompleteResult& result;
738 }; 723 };
739 724
740 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ 725 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_
OLDNEW
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/autocomplete/autocomplete.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698