summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autocomplete/autocomplete.cc12
-rw-r--r--chrome/browser/autocomplete/autocomplete.h31
-rw-r--r--chrome/browser/autocomplete/history_contents_provider.cc10
-rw-r--r--chrome/browser/autocomplete/history_url_provider.cc10
-rw-r--r--chrome/browser/autocomplete/keyword_provider.cc6
-rw-r--r--chrome/browser/autocomplete/search_provider.cc8
-rw-r--r--chrome/browser/browser_init.cc11
-rw-r--r--chrome/common/chrome_switches.cc3
-rw-r--r--chrome/common/chrome_switches.h1
9 files changed, 33 insertions, 59 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc
index ba37681..341afa2 100644
--- a/chrome/browser/autocomplete/autocomplete.cc
+++ b/chrome/browser/autocomplete/autocomplete.cc
@@ -547,7 +547,7 @@ void AutocompleteMatch::ValidateClassifications(
// AutocompleteProvider -------------------------------------------------------
// static
-size_t AutocompleteProvider::max_matches_ = 3;
+const size_t AutocompleteProvider::kMaxMatches = 3;
AutocompleteProvider::~AutocompleteProvider() {
Stop();
@@ -608,7 +608,7 @@ std::wstring AutocompleteProvider::StringForURLDisplay(
// AutocompleteResult ---------------------------------------------------------
// static
-size_t AutocompleteResult::max_matches_ = 6;
+const size_t AutocompleteResult::kMaxMatches = 6;
void AutocompleteResult::Selection::Clear() {
destination_url = GURL();
@@ -619,7 +619,7 @@ void AutocompleteResult::Selection::Clear() {
AutocompleteResult::AutocompleteResult() {
// Reserve space for the max number of matches we'll show. The +1 accounts
// for the history shortcut match as it isn't included in max_matches.
- matches_.reserve(max_matches() + 1);
+ matches_.reserve(kMaxMatches + 1);
// It's probably safe to do this in the initializer list, but there's little
// penalty to doing it here and it ensures our object is fully constructed
@@ -667,10 +667,10 @@ void AutocompleteResult::SortAndCull(const AutocompleteInput& input) {
matches_.end());
// Find the top max_matches.
- if (matches_.size() > max_matches()) {
- std::partial_sort(matches_.begin(), matches_.begin() + max_matches(),
+ if (matches_.size() > kMaxMatches) {
+ std::partial_sort(matches_.begin(), matches_.begin() + kMaxMatches,
matches_.end(), &AutocompleteMatch::MoreRelevant);
- matches_.erase(matches_.begin() + max_matches(), matches_.end());
+ matches_.erase(matches_.begin() + kMaxMatches, matches_.end());
}
// HistoryContentsProvider uses a negative relevance as a way to avoid
diff --git a/chrome/browser/autocomplete/autocomplete.h b/chrome/browser/autocomplete/autocomplete.h
index 54bd9ff..e7766dd 100644
--- a/chrome/browser/autocomplete/autocomplete.h
+++ b/chrome/browser/autocomplete/autocomplete.h
@@ -538,11 +538,11 @@ class AutocompleteProvider
// NOTE: Remember to call OnProviderUpdate() if matches_ is updated.
virtual void DeleteMatch(const AutocompleteMatch& match) {}
- static void set_max_matches(size_t max_matches) {
- max_matches_ = max_matches;
- }
-
- static size_t max_matches() { return max_matches_; }
+ // A suggested upper bound for how many matches a provider should return.
+ // TODO(pkasting): http://b/1111299 , http://b/933133 This should go away once
+ // we have good relevance heuristics; the controller should handle all
+ // culling.
+ static const size_t kMaxMatches;
protected:
friend class base::RefCountedThreadSafe<AutocompleteProvider>;
@@ -576,13 +576,7 @@ class AutocompleteProvider
const char* name_;
private:
- // A suggested upper bound for how many matches a provider should return.
- // TODO(pkasting): http://b/1111299 , http://b/933133 This should go away once
- // we have good relevance heuristics; the controller should handle all
- // culling.
- static size_t max_matches_;
-
- DISALLOW_EVIL_CONSTRUCTORS(AutocompleteProvider);
+ DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider);
};
typedef AutocompleteProvider::ACProviderListener ACProviderListener;
@@ -628,11 +622,6 @@ class AutocompleteResult {
bool is_history_what_you_typed_match;
};
- static void set_max_matches(size_t max_matches) {
- max_matches_ = max_matches;
- }
- static size_t max_matches() { return max_matches_; }
-
AutocompleteResult();
// operator=() by another name.
@@ -682,12 +671,12 @@ class AutocompleteResult {
void Validate() const;
#endif
- private:
// Max number of matches we'll show from the various providers. We may end
// up showing an additional shortcut for Destinations->History, see
// AddHistoryContentsShortcut.
- static size_t max_matches_;
+ static const size_t kMaxMatches;
+ private:
ACMatches matches_;
const_iterator default_match_;
@@ -701,7 +690,7 @@ class AutocompleteResult {
// 'foo'" result, and this will contain "http://foo/".
GURL alternate_nav_url_;
- DISALLOW_EVIL_CONSTRUCTORS(AutocompleteResult);
+ DISALLOW_COPY_AND_ASSIGN(AutocompleteResult);
};
// AutocompleteController -----------------------------------------------------
@@ -865,7 +854,7 @@ class AutocompleteController : public ACProviderListener {
// fast or continuously the user is typing.
base::RepeatingTimer<AutocompleteController> update_delay_timer_;
- DISALLOW_EVIL_CONSTRUCTORS(AutocompleteController);
+ DISALLOW_COPY_AND_ASSIGN(AutocompleteController);
};
// AutocompleteLog ------------------------------------------------------------
diff --git a/chrome/browser/autocomplete/history_contents_provider.cc b/chrome/browser/autocomplete/history_contents_provider.cc
index 1e72ceb..5ad20c5 100644
--- a/chrome/browser/autocomplete/history_contents_provider.cc
+++ b/chrome/browser/autocomplete/history_contents_provider.cc
@@ -174,12 +174,12 @@ void HistoryContentsProvider::ConvertResults() {
// This is done to avoid having the history search shortcut show
// 'See 1 previously viewed ...'.
//
- // Note that AutocompleteResult::max_matches() (maximum size of the popup)
- // is different than both max_matches (the provider's maximum) and
+ // Note that AutocompleteResult::kMaxMatches (maximum size of the popup)
+ // is different than both kMaxMatches (the provider's maximum) and
// kMaxMatchCount (the number of items we want from the history).
- size_t max_for_popup = std::min(AutocompleteResult::max_matches() + 1,
+ size_t max_for_popup = std::min(AutocompleteResult::kMaxMatches + 1,
result_refs.size());
- size_t max_for_provider = std::min(max_matches(), result_refs.size());
+ size_t max_for_provider = std::min(kMaxMatches, result_refs.size());
std::partial_sort(result_refs.begin(), result_refs.begin() + max_for_popup,
result_refs.end(), &CompareMatchRelevance);
matches_.clear();
@@ -265,7 +265,7 @@ void HistoryContentsProvider::QueryBookmarks(const AutocompleteInput& input) {
TimeTicks start_time = TimeTicks::Now();
std::vector<bookmark_utils::TitleMatch> matches;
- bookmark_model->GetBookmarksWithTitlesMatching(input.text(), max_matches(),
+ bookmark_model->GetBookmarksWithTitlesMatching(input.text(), kMaxMatches,
&matches);
for (size_t i = 0; i < matches.size(); ++i)
AddBookmarkTitleMatchToResults(matches[i]);
diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc
index a748700..8880a12 100644
--- a/chrome/browser/autocomplete/history_url_provider.cc
+++ b/chrome/browser/autocomplete/history_url_provider.cc
@@ -152,14 +152,14 @@ void HistoryURLProvider::DoAutocomplete(history::HistoryBackend* backend,
++i) {
if (params->cancel)
return; // Canceled in the middle of a query, give up.
- // We only need max_matches results in the end, but before we get there we
+ // We only need kMaxMatches results in the end, but before we get there we
// need to promote lower-quality matches that are prefixes of
// higher-quality matches, and remove lower-quality redirects. So we ask
// for more results than we need, of every prefix type, in hopes this will
// give us far more than enough to work with. CullRedirects() will then
- // reduce the list to the best max_matches results.
+ // reduce the list to the best kMaxMatches results.
db->AutocompleteForPrefix(i->prefix + params->input.text(),
- max_matches() * 2, &url_matches);
+ kMaxMatches * 2, &url_matches);
for (URLRowVector::const_iterator j(url_matches.begin());
j != url_matches.end(); ++j) {
const Prefix* best_prefix = BestPrefix(j->url(), std::wstring());
@@ -205,9 +205,9 @@ void HistoryURLProvider::DoAutocomplete(history::HistoryBackend* backend,
return;
// Remove redirects and trim list to size. We want to provide up to
- // max_matches results plus the What You Typed result, if it was added to
+ // kMaxMatches results plus the What You Typed result, if it was added to
// |history_matches| above.
- CullRedirects(backend, &history_matches, max_matches() + exact_suggestion);
+ CullRedirects(backend, &history_matches, kMaxMatches + exact_suggestion);
// Convert the history matches to autocomplete matches.
for (size_t i = first_match; i < history_matches.size(); ++i) {
diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc
index dcab1c3..9f841cc 100644
--- a/chrome/browser/autocomplete/keyword_provider.cc
+++ b/chrome/browser/autocomplete/keyword_provider.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -133,8 +133,8 @@ void KeywordProvider::Start(const AutocompleteInput& input,
keyword.length(),
remaining_input));
} else {
- if (keyword_matches.size() > max_matches()) {
- keyword_matches.erase(keyword_matches.begin() + max_matches(),
+ if (keyword_matches.size() > kMaxMatches) {
+ keyword_matches.erase(keyword_matches.begin() + kMaxMatches,
keyword_matches.end());
}
for (std::vector<std::wstring>::const_iterator i(keyword_matches.begin());
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index acba81e..beda1f3 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -328,7 +328,7 @@ void SearchProvider::ScheduleHistoryQuery(TemplateURL::IDType search_id,
profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
HistoryService::Handle request_handle =
history_service->GetMostRecentKeywordSearchTerms(
- search_id, text, static_cast<int>(max_matches()),
+ search_id, text, static_cast<int>(kMaxMatches),
&history_request_consumer_,
NewCallback(this,
&SearchProvider::OnGotMostRecentKeywordSearchTerms));
@@ -440,7 +440,7 @@ bool SearchProvider::ParseSuggestResults(Value* root_val,
NavigationResults& navigation_results =
is_keyword ? keyword_navigation_results_ :
default_navigation_results_;
- if ((navigation_results.size() < max_matches()) &&
+ if ((navigation_results.size() < kMaxMatches) &&
description_list && description_list->Get(i, &site_val) &&
site_val->IsType(Value::TYPE_STRING) &&
site_val->GetAsString(&site_name)) {
@@ -454,7 +454,7 @@ bool SearchProvider::ParseSuggestResults(Value* root_val,
} else {
// TODO(kochi): Currently we treat a calculator result as a query, but it
// is better to have better presentation for caluculator results.
- if (suggest_results->size() < max_matches())
+ if (suggest_results->size() < kMaxMatches)
suggest_results->push_back(suggestion_str);
}
}
@@ -499,7 +499,7 @@ void SearchProvider::ConvertResultsToAutocompleteMatches() {
AddNavigationResultsToMatches(keyword_navigation_results_, true);
AddNavigationResultsToMatches(default_navigation_results_, false);
- const size_t max_total_matches = max_matches() + 1; // 1 for "what you typed"
+ const size_t max_total_matches = kMaxMatches + 1; // 1 for "what you typed"
std::partial_sort(matches_.begin(),
matches_.begin() + std::min(max_total_matches, matches_.size()),
matches_.end(), &AutocompleteMatch::MoreRelevant);
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc
index 536e808..e20dfa2 100644
--- a/chrome/browser/browser_init.cc
+++ b/chrome/browser/browser_init.cc
@@ -898,17 +898,6 @@ bool BrowserInit::ProcessCmdLineImpl(const CommandLine& command_line,
BrowserInit* browser_init) {
DCHECK(profile);
if (process_startup) {
- const std::string popup_count_string =
- command_line.GetSwitchValueASCII(switches::kOmniBoxPopupCount);
- if (!popup_count_string.empty()) {
- int count = 0;
- if (StringToInt(popup_count_string, &count)) {
- const int popup_count = std::max(0, count);
- AutocompleteResult::set_max_matches(popup_count);
- AutocompleteProvider::set_max_matches(popup_count / 2);
- }
- }
-
if (command_line.HasSwitch(switches::kDisablePromptOnRepost))
NavigationController::DisablePromptOnRepost();
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 2b14989..0713882 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -578,9 +578,6 @@ const char kNoProxyServer[] = "no-proxy-server";
// Runs the renderer outside the sandbox.
const char kNoSandbox[] = "no-sandbox";
-// Number of entries to show in the omnibox popup.
-const char kOmniBoxPopupCount[] = "omnibox-popup-count";
-
// Launch URL in new browser window.
const char kOpenInNewWindow[] = "new-window";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index d9ac1e9..1167178 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -167,7 +167,6 @@ extern const char kNoJsRandomness[];
extern const char kNoProxyServer[];
extern const char kNoReferrers[];
extern const char kNoSandbox[];
-extern const char kOmniBoxPopupCount[];
extern const char kOpenInNewWindow[];
extern const char kPackExtension[];
extern const char kPackExtensionKey[];