Bug 1264868 - Handle ACTION_VIEW_MULTIPLE intent when creating BrowserApp. r=mcomella

MozReview-Commit-ID: 9WlTn8GcAev

--HG--
extra : rebase_source : 7b1eb093c71f9a59fe1e5acea3b912c4862312d1
extra : amend_source : 510b3a9c5f5f6761420e67ccf17d5da01eff9faf
This commit is contained in:
Sebastian Kaspari 2016-04-18 14:24:05 +02:00
parent cd0175f41d
commit c580d240d5

View File

@ -650,6 +650,12 @@ public class BrowserApp extends GeckoApp
mBrowserToolbar.setTitle(intent.getDataString());
showTabQueuePromptIfApplicable(intent);
} else if (ACTION_VIEW_MULTIPLE.equals(action) && savedInstanceState == null) {
// We only want to handle this intent if savedInstanceState is null. In the case where
// savedInstanceState is not null this activity is being re-created and we already
// opened tabs for the URLs the last time. Our session store will take care of restoring
// them.
openMultipleTabsFromIntent(intent);
} else if (GuestSession.NOTIFICATION_INTENT.equals(action)) {
GuestSession.handleIntent(this, intent);
} else if (TabQueueHelper.LOAD_URLS_ACTION.equals(action)) {
@ -1031,6 +1037,23 @@ public class BrowserApp extends GeckoApp
}
}
private void openMultipleTabsFromIntent(final Intent intent) {
final List<String> urls = intent.getStringArrayListExtra("urls");
if (urls != null) {
openUrls(urls);
}
// Launched from a "content notification"
if (intent.hasExtra(CheckForUpdatesAction.EXTRA_CONTENT_NOTIFICATION)) {
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(this));
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.NOTIFICATION, "content_update");
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT, "content_update");
Telemetry.stopUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(this));
}
}
@Override
public void onResume() {
super.onResume();
@ -3775,20 +3798,7 @@ public class BrowserApp extends GeckoApp
// Custom intent action for opening multiple URLs at once
if (isViewMultipleAction) {
List<String> urls = intent.getStringArrayListExtra("urls");
if (urls != null) {
openUrls(urls);
}
// Launched from a "content notification"
if (intent.hasExtra(CheckForUpdatesAction.EXTRA_CONTENT_NOTIFICATION)) {
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(this));
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.NOTIFICATION, "content_update");
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT, "content_update");
Telemetry.stopUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(this));
}
openMultipleTabsFromIntent(intent);
}
if (!mInitialized || !Intent.ACTION_MAIN.equals(action)) {