We should figure out whether we need template url service guards in search provider, zero suggest provider, and friends. See link below for places where the guards are in place now. Note that not too many of these guards are explained and the those that are suggest that "|template_url_service| can be null in tests." https://cs.chromium.org/chromium/src/components/omnibox/browser/autocomplete_match.cc?type=cs&q=template_url_service&l=453 https://cs.chromium.org/chromium/src/components/omnibox/browser/history_url_provider.cc?q=template_url_service&l=513 https://cs.chromium.org/chromium/src/components/omnibox/browser/contextual_suggestions_service.cc?q=template_url_service&l=121 https://cs.chromium.org/chromium/src/components/omnibox/browser/base_search_provider.cc?q=template_url_service&l=366 https://cs.chromium.org/chromium/src/components/omnibox/browser/search_provider.cc?q=template_url_service&l=139
Also, if it turns out we need guards on template_url_service under some conditions, we might be missing some. All uses of template_url_service in search_provider (and friends) should be audited (and maybe all uses in the whole omnibox component).
fwiw, most of the above links have already moved. I guess we want to grep for 'if \((!)?template_url_service'. There are about a dozen currently.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9bdd15dbe7a1233b86b7a1150c7698568775d643 commit 9bdd15dbe7a1233b86b7a1150c7698568775d643 Author: Kevin Bailey <krb@chromium.org> Date: Wed Feb 28 04:07:49 2018 [omnibox] Better checking of passing null TemplateURLService Many unit tests pass a null TemplateURLService* to the Omnibox functions. These functions should be able to handle that. This CL represents a pass through those functions, making sure that they either handle a null pointer, or DCHECK. It also includes a few minor fixes found along the way. Bug: 804470 Change-Id: I2e575121d167b0620cd95881466dbd4d47679ade Reviewed-on: https://chromium-review.googlesource.com/937394 Commit-Queue: Kevin Bailey <krb@chromium.org> Reviewed-by: Justin Donnelly <jdonnelly@chromium.org> Cr-Commit-Position: refs/heads/master@{#539702} [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/autocomplete_match.cc [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/base_search_provider_unittest.cc [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/bookmark_provider_unittest.cc [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/clipboard_url_provider_unittest.cc [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/contextual_suggestions_service.cc [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/keyword_provider_unittest.cc [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/mock_autocomplete_provider_client.h [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/omnibox_popup_model.cc [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/physical_web_provider_unittest.cc [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/search_provider.cc [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/test_omnibox_client.cc [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/zero_suggest_provider.cc [modify] https://crrev.com/9bdd15dbe7a1233b86b7a1150c7698568775d643/components/omnibox/browser/zero_suggest_provider_unittest.cc
Comment 1 by mpear...@chromium.org
, Jan 22 2018Status: Available (was: Untriaged)