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

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

Issue 415053002: Remove AutocompleteMatch::is_starred (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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) 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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/prefs/pref_service.h" 14 #include "base/prefs/pref_service.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "chrome/browser/autocomplete/autocomplete_match.h" 18 #include "chrome/browser/autocomplete/autocomplete_match.h"
19 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" 19 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h"
20 #include "chrome/browser/autocomplete/autocomplete_result.h" 20 #include "chrome/browser/autocomplete/autocomplete_result.h"
21 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 21 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
22 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
23 #include "chrome/browser/history/history_backend.h" 22 #include "chrome/browser/history/history_backend.h"
24 #include "chrome/browser/history/history_database.h" 23 #include "chrome/browser/history/history_database.h"
25 #include "chrome/browser/history/history_service.h" 24 #include "chrome/browser/history/history_service.h"
26 #include "chrome/browser/history/history_service_factory.h" 25 #include "chrome/browser/history/history_service_factory.h"
27 #include "chrome/browser/history/history_types.h" 26 #include "chrome/browser/history/history_types.h"
28 #include "chrome/browser/history/in_memory_url_index_types.h" 27 #include "chrome/browser/history/in_memory_url_index_types.h"
29 #include "chrome/browser/history/scored_history_match.h" 28 #include "chrome/browser/history/scored_history_match.h"
30 #include "chrome/browser/omnibox/omnibox_field_trial.h" 29 #include "chrome/browser/omnibox/omnibox_field_trial.h"
31 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/browser/search_engines/template_url_service_factory.h" 31 #include "chrome/browser/search_engines/template_url_service_factory.h"
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 // initialize). In this case all we can do is fall back on the second 569 // initialize). In this case all we can do is fall back on the second
571 // pass. 570 // pass.
572 // 571 //
573 // TODO(pkasting): We should just block here until this loads. Any time 572 // TODO(pkasting): We should just block here until this loads. Any time
574 // someone unloads the history backend, we'll get inconsistent inline 573 // someone unloads the history backend, we'll get inconsistent inline
575 // autocomplete behavior here. 574 // autocomplete behavior here.
576 if (url_db) { 575 if (url_db) {
577 DoAutocomplete(NULL, url_db, params.get()); 576 DoAutocomplete(NULL, url_db, params.get());
578 matches_.clear(); 577 matches_.clear();
579 PromoteMatchesIfNecessary(*params); 578 PromoteMatchesIfNecessary(*params);
580 UpdateStarredStateOfMatches(BookmarkModelFactory::GetForProfile(profile_));
581 // NOTE: We don't reset |params| here since at least the |promote_type| 579 // NOTE: We don't reset |params| here since at least the |promote_type|
582 // field on it will be read by the second pass -- see comments in 580 // field on it will be read by the second pass -- see comments in
583 // DoAutocomplete(). 581 // DoAutocomplete().
584 } 582 }
585 583
586 // Pass 2: Ask the history service to call us back on the history thread, 584 // Pass 2: Ask the history service to call us back on the history thread,
587 // where we can read the full on-disk DB. 585 // where we can read the full on-disk DB.
588 if (input.want_asynchronous_matches()) { 586 if (input.want_asynchronous_matches()) {
589 done_ = false; 587 done_ = false;
590 params_ = params.release(); // This object will be destroyed in 588 params_ = params.release(); // This object will be destroyed in
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 for (size_t i = first_match; i < params->matches.size(); ++i) { 884 for (size_t i = first_match; i < params->matches.size(); ++i) {
887 // All matches score one less than the previous match. 885 // All matches score one less than the previous match.
888 --relevance; 886 --relevance;
889 // The experimental scoring must not change the top result's score. 887 // The experimental scoring must not change the top result's score.
890 if (!matches_.empty()) { 888 if (!matches_.empty()) {
891 relevance = CalculateRelevanceScoreUsingScoringParams( 889 relevance = CalculateRelevanceScoreUsingScoringParams(
892 params->matches[i], relevance, scoring_params_); 890 params->matches[i], relevance, scoring_params_);
893 } 891 }
894 matches_.push_back(HistoryMatchToACMatch(*params, i, NORMAL, relevance)); 892 matches_.push_back(HistoryMatchToACMatch(*params, i, NORMAL, relevance));
895 } 893 }
896 UpdateStarredStateOfMatches(BookmarkModelFactory::GetForProfile(profile_));
897 } 894 }
898 895
899 done_ = true; 896 done_ = true;
900 listener_->OnProviderUpdate(true); 897 listener_->OnProviderUpdate(true);
901 } 898 }
902 899
903 bool HistoryURLProvider::FixupExactSuggestion( 900 bool HistoryURLProvider::FixupExactSuggestion(
904 history::URLDatabase* db, 901 history::URLDatabase* db,
905 const VisitClassifier& classifier, 902 const VisitClassifier& classifier,
906 HistoryURLProviderParams* params) const { 903 HistoryURLProviderParams* params) const {
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, 1193 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0,
1197 match.contents.length(), ACMatchClassification::URL, 1194 match.contents.length(), ACMatchClassification::URL,
1198 &match.contents_class); 1195 &match.contents_class);
1199 } 1196 }
1200 match.description = info.title(); 1197 match.description = info.title();
1201 match.description_class = 1198 match.description_class =
1202 ClassifyDescription(params.input.text(), match.description); 1199 ClassifyDescription(params.input.text(), match.description);
1203 RecordAdditionalInfoFromUrlRow(info, &match); 1200 RecordAdditionalInfoFromUrlRow(info, &match);
1204 return match; 1201 return match;
1205 } 1202 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_quick_provider.cc ('k') | chrome/browser/autocomplete/search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698