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

Unified Diff: components/omnibox/browser/history_url_provider.cc

Issue 2048693003: Misc. omnibox cleanup: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/omnibox/browser/history_url_provider.cc
diff --git a/components/omnibox/browser/history_url_provider.cc b/components/omnibox/browser/history_url_provider.cc
index 9747452afa24a387d48f670458bb1a8010500ed1..a3cdf351267f7b525b5b2dffbf84bd218331551d 100644
--- a/components/omnibox/browser/history_url_provider.cc
+++ b/components/omnibox/browser/history_url_provider.cc
@@ -127,7 +127,8 @@ double CalculateRelevanceUsingScoreBuckets(
if (decayed_count > 0)
decayed_count *= decay_factor;
- const HUPScoringParams::ScoreBuckets::CountMaxRelevance* score_bucket = NULL;
+ const HUPScoringParams::ScoreBuckets::CountMaxRelevance* score_bucket =
+ nullptr;
const double factor = (score_buckets.use_decay_factor() ?
decay_factor : decayed_count);
for (size_t i = 0; i < score_buckets.buckets().size(); ++i) {
@@ -434,7 +435,7 @@ HistoryURLProviderParams::HistoryURLProviderParams(
exact_suggestion_is_in_history(false),
promote_type(NEITHER),
default_search_provider(default_search_provider ?
- new TemplateURL(default_search_provider->data()) : NULL),
+ new TemplateURL(default_search_provider->data()) : nullptr),
search_terms_data(new SearchTermsDataSnapshot(search_terms_data)) {
}
@@ -445,7 +446,7 @@ HistoryURLProvider::HistoryURLProvider(AutocompleteProviderClient* client,
AutocompleteProviderListener* listener)
: HistoryProvider(AutocompleteProvider::TYPE_HISTORY_URL, client),
listener_(listener),
- params_(NULL),
+ params_(nullptr),
search_url_database_(OmniboxFieldTrial::HUPSearchDatabase()) {
// Initialize the default HUP scoring params.
OmniboxFieldTrial::GetDefaultHUPScoringParams(&scoring_params_);
@@ -505,10 +506,10 @@ void HistoryURLProvider::Start(const AutocompleteInput& input,
// Get the default search provider and search terms data now since we have to
// retrieve these on the UI thread, and the second pass runs on the history
- // thread. |template_url_service| can be NULL when testing.
+ // thread. |template_url_service| can be null when testing.
TemplateURLService* template_url_service = client()->GetTemplateURLService();
TemplateURL* default_search_provider = template_url_service ?
- template_url_service->GetDefaultSearchProvider() : NULL;
+ template_url_service->GetDefaultSearchProvider() : nullptr;
// Create the data structure for the autocomplete passes. We'll save this off
// onto the |params_| member for later deletion below if we need to run pass
@@ -523,15 +524,14 @@ void HistoryURLProvider::Start(const AutocompleteInput& input,
// Pass 1: Get the in-memory URL database, and use it to find and promote
// the inline autocomplete match, if any.
history::URLDatabase* url_db = history_service->InMemoryDatabase();
- // url_db can be NULL if it hasn't finished initializing (or failed to
- // initialize). In this case all we can do is fall back on the second
- // pass.
+ // url_db can be null if it hasn't finished initializing (or failed to
+ // initialize). In this case all we can do is fall back on the second pass.
//
// TODO(pkasting): We should just block here until this loads. Any time
// someone unloads the history backend, we'll get inconsistent inline
// autocomplete behavior here.
if (url_db) {
- DoAutocomplete(NULL, url_db, params.get());
+ DoAutocomplete(nullptr, url_db, params.get());
matches_.clear();
PromoteMatchesIfNecessary(*params);
// NOTE: We don't reset |params| here since at least the |promote_type|
@@ -601,10 +601,10 @@ AutocompleteMatch HistoryURLProvider::SuggestExactInput(
const URLPrefix* best_prefix = URLPrefix::BestURLPrefix(
base::UTF8ToUTF16(destination_url.spec()), input.text());
// It's possible for match.destination_url to not contain the user's input
- // at all (so |best_prefix| is NULL), for example if the input is
+ // at all (so |best_prefix| is null), for example if the input is
// "view-source:x" and |destination_url| has an inserted "http://" in the
// middle.
- if (best_prefix == NULL) {
+ if (!best_prefix) {
AutocompleteMatch::ClassifyMatchInString(input.text(),
match.contents,
ACMatchClassification::URL,
@@ -623,7 +623,7 @@ AutocompleteMatch HistoryURLProvider::SuggestExactInput(
void HistoryURLProvider::ExecuteWithDB(HistoryURLProviderParams* params,
history::HistoryBackend* backend,
history::URLDatabase* db) {
- // We may get called with a NULL database if it couldn't be properly
+ // We may get called with a null database if it couldn't be properly
// initialized.
if (!db) {
params->failed = true;
@@ -846,7 +846,7 @@ void HistoryURLProvider::QueryComplete(
// If the user hasn't already started another query, clear our member pointer
// so we can't write into deleted memory.
if (params_ == params_gets_deleted)
- params_ = NULL;
+ params_ = nullptr;
// Don't send responses for queries that have been canceled.
if (params->cancel_flag.IsSet())
« no previous file with comments | « components/omnibox/browser/autocomplete_controller.cc ('k') | components/omnibox/browser/omnibox_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698