Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set proper DDG config as a default alternate SE except QWANT region in Tor #9486

Merged
merged 1 commit into from
Jul 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "chrome/browser/profiles/profile.h"
#include "components/prefs/pref_service.h"
#include "components/search_engines/search_engines_pref_names.h"
#include "components/search_engines/template_url_data_util.h"
#include "components/search_engines/template_url_prepopulate_data.h"
#include "components/search_engines/template_url_service.h"

Expand Down Expand Up @@ -54,26 +55,14 @@ void TorWindowSearchEngineProviderService::OnTemplateURLServiceChanged() {
std::unique_ptr<TemplateURLData>
TorWindowSearchEngineProviderService::GetInitialSearchEngineProvider(
PrefService* prefs) const {
std::unique_ptr<TemplateURLData> provider_data;

int initial_id = TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(
Copy link
Member Author

@simonhong simonhong Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using TemplateURLPrepopulateData::duckduckgo for all regions,
how about using this logic(https://github.com/brave/brave-core/pull/9486/files#diff-303c4f4e4e368bfb2681efc54ff35e1412d362740939fc50c7f93b9b92bcca2cL42) for private and tor profile both?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already talked on Slack- but just documenting that we can use regular DDG link for Tor window 👍

otr_profile_->GetPrefs())
->prepopulate_id;
switch (initial_id) {
case TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_QWANT:
case TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_DUCKDUCKGO:
case TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_DUCKDUCKGO_DE:
case TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE:
break;

default:
initial_id =
TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_DUCKDUCKGO;
break;
std::unique_ptr<TemplateURLData> provider_data =
TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(
otr_profile_->GetPrefs());
if (provider_data->prepopulate_id ==
TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_QWANT) {
return provider_data;
}
provider_data =
TemplateURLPrepopulateData::GetPrepopulatedEngine(prefs, initial_id);

DCHECK(provider_data);
return provider_data;
return TemplateURLDataFromPrepopulatedEngine(
TemplateURLPrepopulateData::duckduckgo);
}