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

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

Issue 1129733006: Omnibox - Code Cleanup - Remove Unnecessary is_history_what_you_typed_match (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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/history_url_provider.h" 5 #include "chrome/browser/autocomplete/history_url_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 if (best_prefix == NULL) { 638 if (best_prefix == NULL) {
639 AutocompleteMatch::ClassifyMatchInString(text, match.contents, 639 AutocompleteMatch::ClassifyMatchInString(text, match.contents,
640 ACMatchClassification::URL, 640 ACMatchClassification::URL,
641 &match.contents_class); 641 &match.contents_class);
642 } else { 642 } else {
643 AutocompleteMatch::ClassifyLocationInString( 643 AutocompleteMatch::ClassifyLocationInString(
644 best_prefix->prefix.length() - offset, text.length(), 644 best_prefix->prefix.length() - offset, text.length(),
645 match.contents.length(), ACMatchClassification::URL, 645 match.contents.length(), ACMatchClassification::URL,
646 &match.contents_class); 646 &match.contents_class);
647 } 647 }
648
649 match.is_history_what_you_typed_match = true;
650 } 648 }
651 649
652 return match; 650 return match;
653 } 651 }
654 652
655 void HistoryURLProvider::ExecuteWithDB(HistoryURLProviderParams* params, 653 void HistoryURLProvider::ExecuteWithDB(HistoryURLProviderParams* params,
656 history::HistoryBackend* backend, 654 history::HistoryBackend* backend,
657 history::URLDatabase* db) { 655 history::URLDatabase* db) {
658 // We may get called with a NULL database if it couldn't be properly 656 // We may get called with a NULL database if it couldn't be properly
659 // initialized. 657 // initialized.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 ((params->input.type() != metrics::OmniboxInputType::UNKNOWN) || 769 ((params->input.type() != metrics::OmniboxInputType::UNKNOWN) ||
772 (classifier.type() == VisitClassifier::UNVISITED_INTRANET) || 770 (classifier.type() == VisitClassifier::UNVISITED_INTRANET) ||
773 !params->trim_http || 771 !params->trim_http ||
774 (AutocompleteInput::NumNonHostComponents(params->input.parts()) > 0) || 772 (AutocompleteInput::NumNonHostComponents(params->input.parts()) > 0) ||
775 !params->default_search_provider); 773 !params->default_search_provider);
776 const bool have_shorter_suggestion_suitable_for_inline_autocomplete = 774 const bool have_shorter_suggestion_suitable_for_inline_autocomplete =
777 PromoteOrCreateShorterSuggestion(db, params); 775 PromoteOrCreateShorterSuggestion(db, params);
778 776
779 // Check whether what the user typed appears in history. 777 // Check whether what the user typed appears in history.
780 const bool can_check_history_for_exact_match = 778 const bool can_check_history_for_exact_match =
781 // Checking what_you_typed_match.is_history_what_you_typed_match tells us 779 // Checking what_you_typed_match.allowed_to_be_default_match tells us
782 // whether SuggestExactInput() succeeded in constructing a valid match. 780 // whether SuggestExactInput() succeeded in constructing a valid match.
783 params->what_you_typed_match.is_history_what_you_typed_match && 781 params->what_you_typed_match.allowed_to_be_default_match &&
784 // Additionally, in the case where the user has typed "foo.com" and 782 // Additionally, in the case where the user has typed "foo.com" and
785 // visited (but not typed) "foo/", and the input is "foo", the first pass 783 // visited (but not typed) "foo/", and the input is "foo", the first pass
786 // will fall into the FRONT_HISTORY_MATCH case for "foo.com" but the 784 // will fall into the FRONT_HISTORY_MATCH case for "foo.com" but the
787 // second pass can suggest the exact input as a better URL. Since we need 785 // second pass can suggest the exact input as a better URL. Since we need
788 // both passes to agree, and since during the first pass there's no way to 786 // both passes to agree, and since during the first pass there's no way to
789 // know about "foo/", ensure that if the promote type was set to 787 // know about "foo/", ensure that if the promote type was set to
790 // FRONT_HISTORY_MATCH during the first pass, the second pass will not 788 // FRONT_HISTORY_MATCH during the first pass, the second pass will not
791 // consider the exact suggestion to be in history and therefore will not 789 // consider the exact suggestion to be in history and therefore will not
792 // suggest the exact input as a better match. (Note that during the first 790 // suggest the exact input as a better match. (Note that during the first
793 // pass, this conditional will always succeed since |promote_type| is 791 // pass, this conditional will always succeed since |promote_type| is
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, 1179 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0,
1182 match.contents.length(), ACMatchClassification::URL, 1180 match.contents.length(), ACMatchClassification::URL,
1183 &match.contents_class); 1181 &match.contents_class);
1184 } 1182 }
1185 match.description = info.title(); 1183 match.description = info.title();
1186 match.description_class = 1184 match.description_class =
1187 ClassifyDescription(params.input.text(), match.description); 1185 ClassifyDescription(params.input.text(), match.description);
1188 RecordAdditionalInfoFromUrlRow(info, &match); 1186 RecordAdditionalInfoFromUrlRow(info, &match);
1189 return match; 1187 return match;
1190 } 1188 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_provider.cc ('k') | chrome/browser/autocomplete/zero_suggest_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698