Skip to content

Commit

Permalink
Merge pull request #685 from brave/show_ddg_in_qwant_region
Browse files Browse the repository at this point in the history
Show DDG newtab in Qwant region if Qwant is not used
  • Loading branch information
bsclifton committed Oct 18, 2018
1 parent 55dfdee commit 64101fc
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions browser/ui/webui/brave_new_tab_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
}
}

Expand Down

0 comments on commit 64101fc

Please sign in to comment.