93
93
import java .util .HashMap ;
94
94
import java .util .HashSet ;
95
95
import java .util .LinkedList ;
96
- import java .util .Objects ;
97
96
import java .util .Set ;
98
97
import java .util .concurrent .CopyOnWriteArrayList ;
99
98
import java .util .function .Consumer ;
100
- import java .util .function .Function ;
101
99
102
100
import static org .mozilla .vrbrowser .ui .widgets .UIWidget .REMOVE_WIDGET ;
103
101
@@ -549,12 +547,11 @@ protected void onNewIntent(final Intent intent) {
549
547
Log .d (LOGTAG ,"VRBrowserActivity onNewIntent" );
550
548
super .onNewIntent (intent );
551
549
setIntent (intent );
552
- final String action = intent .getAction ();
553
- if (Intent .ACTION_VIEW .equals (action )) {
554
- loadFromIntent (intent );
555
550
556
- } else if (GeckoRuntime .ACTION_CRASHED .equals (intent .getAction ())) {
551
+ if (GeckoRuntime .ACTION_CRASHED .equals (intent .getAction ())) {
557
552
Log .e (LOGTAG , "Restarted after a crash" );
553
+ } else {
554
+ loadFromIntent (intent );
558
555
}
559
556
}
560
557
@@ -600,7 +597,6 @@ void loadFromIntent(final Intent intent) {
600
597
Uri uri = intent .getData ();
601
598
602
599
boolean openInWindow = false ;
603
- boolean openInTab = false ;
604
600
boolean openInBackground = false ;
605
601
606
602
Bundle extras = intent .getExtras ();
@@ -616,14 +612,6 @@ void loadFromIntent(final Intent intent) {
616
612
SettingsStore .getInstance (this ).setHomepage (homepageUri .toString ());
617
613
}
618
614
619
- // Open the provided URL in a new tab, if there is no URL provided we just open the homepage
620
- if (extras .containsKey ("create_new_tab" )) {
621
- openInTab = extras .getBoolean ("create_new_tab" , false );
622
- if (uri == null ) {
623
- uri = Uri .parse (SettingsStore .getInstance (this ).getHomepage ());
624
- }
625
- }
626
-
627
615
// Open the tab in background/foreground, if there is no URL provided we just open the homepage
628
616
if (extras .containsKey ("background" )) {
629
617
openInBackground = extras .getBoolean ("background" , false );
@@ -659,21 +647,14 @@ void loadFromIntent(final Intent intent) {
659
647
if (uri != null ) {
660
648
Log .d (LOGTAG , "Loading URI from intent: " + uri .toString ());
661
649
662
- if (openInWindow ) {
663
- openNewWindow (uri .toString ());
664
-
665
- } else if (openInTab ) {
666
- if (openInBackground ) {
667
- openNewTab (uri .toString ());
668
-
669
- } else {
670
- openNewTabForeground (uri .toString ());
671
- }
650
+ int location = Windows .OPEN_IN_FOREGROUND ;
672
651
673
- } else {
674
- SessionStore .get ().getActiveSession ().loadUri (uri .toString ());
652
+ if (openInWindow ) {
653
+ location = Windows .OPEN_IN_NEW_WINDOW ;
654
+ } else if (openInBackground ) {
655
+ location = Windows .OPEN_IN_BACKGROUND ;
675
656
}
676
-
657
+ mWindows . openNewTabAfterRestore ( uri . toString (), location );
677
658
} else {
678
659
mWindows .getFocusedWindow ().loadHomeIfNotRestored ();
679
660
}
0 commit comments