From 64101fc1be24d425986de0c8fe2e0acf7f262e8b Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Thu, 18 Oct 2018 09:45:21 -0700 Subject: [PATCH] Merge pull request #685 from brave/show_ddg_in_qwant_region Show DDG newtab in Qwant region if Qwant is not used --- browser/ui/webui/brave_new_tab_ui.cc | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/browser/ui/webui/brave_new_tab_ui.cc b/browser/ui/webui/brave_new_tab_ui.cc index 2c388429133e..7458d3f03c14 100644 --- a/browser/ui/webui/brave_new_tab_ui.cc +++ b/browser/ui/webui/brave_new_tab_ui.cc @@ -44,16 +44,10 @@ class NewTabDOMHandler : public content::WebUIMessageHandler { DISALLOW_COPY_AND_ASSIGN(NewTabDOMHandler); }; -bool IsQwantUsedInQwantRegion(Profile* profile) { - bool region_for_qwant = - TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch( - profile->GetPrefs())->prepopulate_id == - TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_QWANT; - bool qwant_used = profile->IsTorProfile() - ? profile->GetPrefs()->GetInteger(kAlternativeSearchEngineProviderInTor) == - TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_QWANT - : true; - return region_for_qwant && qwant_used; +bool IsRegionForQwant(Profile* profile) { + return TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch( + profile->GetPrefs())->prepopulate_id == + TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_QWANT; } } // namespace @@ -108,7 +102,7 @@ void BraveNewTabUI::CustomizeNewTabWebUIProperties(content::RenderViewHost* rend render_view_host->SetWebUIProperty( "isTor", profile->IsTorProfile() ? "true" : "false"); render_view_host->SetWebUIProperty( - "isQwant", IsQwantUsedInQwantRegion(profile) ? "true" : "false"); + "isQwant", IsRegionForQwant(profile) ? "true" : "false"); } }