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

Side by Side Diff: components/omnibox/browser/history_url_provider.cc

Issue 2816383002: Remove non-const version of GetDefaultSearchProvider() and make all callers call the const version (Closed)
Patch Set: Fix unit test (the model was already loaded) Created 3 years, 8 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 "components/omnibox/browser/history_url_provider.h" 5 #include "components/omnibox/browser/history_url_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 // different port and/or path) before. 412 // different port and/or path) before.
413 url_row_ = history::URLRow(url); 413 url_row_ = history::URLRow(url);
414 type_ = UNVISITED_INTRANET; 414 type_ = UNVISITED_INTRANET;
415 } 415 }
416 } 416 }
417 417
418 HistoryURLProviderParams::HistoryURLProviderParams( 418 HistoryURLProviderParams::HistoryURLProviderParams(
419 const AutocompleteInput& input, 419 const AutocompleteInput& input,
420 bool trim_http, 420 bool trim_http,
421 const AutocompleteMatch& what_you_typed_match, 421 const AutocompleteMatch& what_you_typed_match,
422 TemplateURL* default_search_provider, 422 const TemplateURL* default_search_provider,
423 const SearchTermsData& search_terms_data) 423 const SearchTermsData& search_terms_data)
424 : origin_task_runner(base::SequencedTaskRunnerHandle::Get()), 424 : origin_task_runner(base::SequencedTaskRunnerHandle::Get()),
425 input(input), 425 input(input),
426 prevent_inline_autocomplete(input.prevent_inline_autocomplete()), 426 prevent_inline_autocomplete(input.prevent_inline_autocomplete()),
427 trim_http(trim_http), 427 trim_http(trim_http),
428 what_you_typed_match(what_you_typed_match), 428 what_you_typed_match(what_you_typed_match),
429 failed(false), 429 failed(false),
430 exact_suggestion_is_in_history(false), 430 exact_suggestion_is_in_history(false),
431 promote_type(NEITHER), 431 promote_type(NEITHER),
432 default_search_provider( 432 default_search_provider(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // We'll need the history service to run both passes, so try to obtain it. 497 // We'll need the history service to run both passes, so try to obtain it.
498 history::HistoryService* const history_service = 498 history::HistoryService* const history_service =
499 client()->GetHistoryService(); 499 client()->GetHistoryService();
500 if (!history_service) 500 if (!history_service)
501 return; 501 return;
502 502
503 // Get the default search provider and search terms data now since we have to 503 // Get the default search provider and search terms data now since we have to
504 // retrieve these on the UI thread, and the second pass runs on the history 504 // retrieve these on the UI thread, and the second pass runs on the history
505 // thread. |template_url_service| can be null when testing. 505 // thread. |template_url_service| can be null when testing.
506 TemplateURLService* template_url_service = client()->GetTemplateURLService(); 506 TemplateURLService* template_url_service = client()->GetTemplateURLService();
507 TemplateURL* default_search_provider = template_url_service ? 507 const TemplateURL* default_search_provider = template_url_service ?
508 template_url_service->GetDefaultSearchProvider() : nullptr; 508 template_url_service->GetDefaultSearchProvider() : nullptr;
509 509
510 // Create the data structure for the autocomplete passes. We'll save this off 510 // Create the data structure for the autocomplete passes. We'll save this off
511 // onto the |params_| member for later deletion below if we need to run pass 511 // onto the |params_| member for later deletion below if we need to run pass
512 // 2. 512 // 2.
513 std::unique_ptr<HistoryURLProviderParams> params(new HistoryURLProviderParams( 513 std::unique_ptr<HistoryURLProviderParams> params(new HistoryURLProviderParams(
514 fixed_up_input, trim_http, what_you_typed_match, default_search_provider, 514 fixed_up_input, trim_http, what_you_typed_match, default_search_provider,
515 client()->GetSearchTermsData())); 515 client()->GetSearchTermsData()));
516 // Note that we use the non-fixed-up input here, since fixup may strip 516 // Note that we use the non-fixed-up input here, since fixup may strip
517 // trailing whitespace. 517 // trailing whitespace.
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, 1187 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0,
1188 match.contents.length(), ACMatchClassification::URL, 1188 match.contents.length(), ACMatchClassification::URL,
1189 &match.contents_class); 1189 &match.contents_class);
1190 } 1190 }
1191 match.description = info.title(); 1191 match.description = info.title();
1192 match.description_class = 1192 match.description_class =
1193 ClassifyDescription(params.input.text(), match.description); 1193 ClassifyDescription(params.input.text(), match.description);
1194 RecordAdditionalInfoFromUrlRow(info, &match); 1194 RecordAdditionalInfoFromUrlRow(info, &match);
1195 return match; 1195 return match;
1196 } 1196 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/history_url_provider.h ('k') | components/search_engines/template_url.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698