Skip to content

Commit

Permalink
Bug 1329152 - turn on CustomTabs via SwitchBoard r=nechen,sebastian
Browse files Browse the repository at this point in the history
We are going to enable Custom Tabs by default. Now it is still
controlled by SwitchBoard in case of any accident.

MozReview-Commit-ID: JREAhkYzVSu
  • Loading branch information
walkingice committed Apr 21, 2017
1 parent 76abaa1 commit 69b9f5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions mobile/android/base/java/org/mozilla/gecko/Experiments.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public class Experiments {
// Show AddOns menu-item in top level menu
public static final String TOP_ADDONS_MENU = "top-addons-menu";

// User in this group will enable Custom Tabs
public static final String CUSTOM_TABS = "custom-tabs";

// Enable full bookmark management(full-page dialog, bookmark/folder modification, etc.)
public static final String FULL_BOOKMARK_MANAGEMENT = "full-bookmark-management";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package org.mozilla.gecko;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
Expand All @@ -14,6 +15,7 @@
import android.util.Log;

import org.mozilla.gecko.home.HomeConfig;
import org.mozilla.gecko.switchboard.SwitchBoard;
import org.mozilla.gecko.webapps.WebAppActivity;
import org.mozilla.gecko.webapps.WebAppIndexer;
import org.mozilla.gecko.customtabs.CustomTabsActivity;
Expand Down Expand Up @@ -70,7 +72,7 @@ protected void onCreate(Bundle savedInstanceState) {
} else if (!isViewIntentWithURL(safeIntent)) {
dispatchNormalIntent();

} else if (isCustomTabsIntent(safeIntent)) {
} else if (isCustomTabsIntent(safeIntent) && isCustomTabsEnabled(this) ) {
dispatchCustomTabsIntent();

// Can we dispatch this VIEW action intent to the tab queue service?
Expand Down Expand Up @@ -159,6 +161,10 @@ private static boolean isViewIntentWithURL(@NonNull final SafeIntent safeIntent)
&& safeIntent.getDataString() != null;
}

private static boolean isCustomTabsEnabled(@NonNull final Context context) {
return SwitchBoard.isInExperiment(context, Experiments.CUSTOM_TABS);
}

private static boolean isCustomTabsIntent(@NonNull final SafeIntent safeIntent) {
return isViewIntentWithURL(safeIntent)
&& safeIntent.hasExtra(CustomTabsIntent.EXTRA_SESSION);
Expand Down

0 comments on commit 69b9f5c

Please sign in to comment.