Remove unnecessary overrides and test
SuggestionsServiceFactory::GetForProfile() returns nullptr if Profile::IsOffTheRecord() is true. So when another factory or client code use the helper method to get the service, it gets a nullptr. The SuggestionsServiceFactory::GetBrowserContextToUse() test happens only in the GetServiceForBrowserContext() call, and thus does not happens when client code use this helper method. The only situation where GetBrowserContextToUse() could be called is if code directly call GetServiceForBrowserContext or if ServiceIsCreatedWithBrowserContext() were overridden to returns true. Since none of those two conditions are true, then the method is never called with an off-the-record Profile and the default implementation inherited from BrowserContextKeyedServiceFactory does the right thing (i.e. returns nullptr, which in turn cause GetServiceForBrowserContext to return nullptr). BUG=None Review URL: https://codereview.chromium.org/744033002 Cr-Commit-Position: refs/heads/master@{#305059}
Showing
Please register or sign in to comment