Bug 1267639 - (Pre) Add onNewIntent() method to BrowserAppDelegate. r=grisha draft
authorSebastian Kaspari <s.kaspari@gmail.com>
Thu, 28 Apr 2016 11:04:33 +0200
changeset 362788 e0d1ed9cd56c91bb8be2659b0024b29844c1401e
parent 357274 830f7765555a3740103c31100118bf318cf785b2
child 362789 9c6f93aad7f070a847b5f13ff38bbcabef684cf6
push id17036
push users.kaspari@gmail.com
push dateTue, 03 May 2016 08:00:31 +0000
reviewersgrisha
bugs1267639
milestone49.0a1
Bug 1267639 - (Pre) Add onNewIntent() method to BrowserAppDelegate. r=grisha MozReview-Commit-ID: KGBLTTPwVV1
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/BrowserAppDelegate.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -3834,16 +3834,20 @@ public class BrowserApp extends GeckoApp
             });
         }
 
         // Custom intent action for opening multiple URLs at once
         if (isViewMultipleAction) {
             openMultipleTabsFromIntent(intent);
         }
 
+        for (final BrowserAppDelegate delegate : delegates) {
+            delegate.onNewIntent(this, intent);
+        }
+
         if (!mInitialized || !Intent.ACTION_MAIN.equals(action)) {
             return;
         }
 
         // Check to see how many times the app has been launched.
         final String keyName = getPackageName() + ".feedback_launch_count";
         final StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskReads();
 
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserAppDelegate.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserAppDelegate.java
@@ -1,15 +1,16 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko;
 
+import android.content.Intent;
 import android.os.Bundle;
 
 import org.mozilla.gecko.tabs.TabsPanel;
 
 /**
  * Abstract class for extending the behavior of BrowserApp without adding additional code to the
  * already huge class.
  */
@@ -45,16 +46,21 @@ public abstract class BrowserAppDelegate
     public void onStop(BrowserApp browserApp) {}
 
     /**
      * The final call before the BrowserApp activity is destroyed.
      */
     public void onDestroy(BrowserApp browserApp) {}
 
     /**
+     * Called when BrowserApp already exists and a new Intent to re-launch it was fired.
+     */
+    public void onNewIntent(BrowserApp browserApp, Intent intent) {}
+
+    /**
      * Called when the tabs tray is opened.
      */
     public void onTabsTrayShown(BrowserApp browserApp, TabsPanel tabsPanel) {}
 
     /**
      * Called when the tabs tray is closed.
      */
     public void onTabsTrayHidden(BrowserApp browserApp, TabsPanel tabsPanel) {}