Skip to content

Commit

Permalink
open in a new tab from brave news in background tab
Browse files Browse the repository at this point in the history
  • Loading branch information
tapanmodh committed Jan 9, 2023
1 parent de42b21 commit 30c3e19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
newTab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TabUtils.openUrlInNewTab(false, mUrl);
TabUtils.openUrlInNewTabInBackground(false, mUrl);
dismiss();
}
});
Expand Down
10 changes: 10 additions & 0 deletions android/java/org/chromium/chrome/browser/util/TabUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ public static void openUrlInNewTab(boolean isIncognito, String url) {
}
}

public static void openUrlInNewTabInBackground(boolean isIncognito, String url) {
BraveActivity braveActivity = BraveActivity.getBraveActivity();
if (braveActivity != null && braveActivity.getTabModelSelector() != null
&& braveActivity.getActivityTab() != null) {
braveActivity.getTabModelSelector().openNewTab(new LoadUrlParams(url),
TabLaunchType.FROM_LONGPRESS_BACKGROUND_IN_GROUP,
braveActivity.getActivityTab(), isIncognito);
}
}

public static void openUrlInSameTab(String url) {
BraveActivity braveActivity = BraveActivity.getBraveActivity();
if (braveActivity != null && braveActivity.getActivityTab() != null) {
Expand Down

0 comments on commit 30c3e19

Please sign in to comment.