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 brave as default for private mode in all regions for new users #27769

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
18 changes: 18 additions & 0 deletions android/java/org/chromium/chrome/browser/app/BraveActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,7 @@ public void finishNativeInitialization() {
if (isFirstInstall && appOpenCount == 0) {
checkForYandexSE();
enableSearchSuggestions();
setBraveAsDefaultPrivateMode();
}

migrateBgPlaybackToFeature();
Expand Down Expand Up @@ -1325,6 +1326,23 @@ public void afterTextChanged(Editable s) {}
}
}

private void setBraveAsDefaultPrivateMode() {
Runnable onTemplateUrlServiceReady =
() -> {
if (isActivityFinishingOrDestroyed()) return;
TemplateUrl braveTemplateUrl =
BraveSearchEngineUtils.getTemplateUrlByShortName(
getCurrentProfile(), OnboardingPrefManager.BRAVE);
if (braveTemplateUrl != null) {
BraveSearchEngineUtils.setDSEPrefs(
braveTemplateUrl,
getCurrentProfile().getPrimaryOtrProfile(/* createIfNeeded= */ true));
}
};
TemplateUrlServiceFactory.getForProfile(getCurrentProfile())
.runWhenLoaded(onTemplateUrlServiceReady);
}

private void enableSearchSuggestions() {
TemplateUrl defaultSearchEngineTemplateUrl =
BraveSearchEngineUtils.getTemplateUrlByShortName(
Expand Down
Loading