Bug 1412818 - Part 1 - Remove unused Toolbar experiments. r?sebastian
MozReview-Commit-ID: 8tky8nF2EVi
--- a/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
@@ -14,43 +14,37 @@ import org.mozilla.gecko.AboutPages;
import org.mozilla.gecko.BrowserApp;
import org.mozilla.gecko.R;
import org.mozilla.gecko.reader.ReaderModeUtils;
import org.mozilla.gecko.SiteIdentity;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.ViewHelper;
-import org.mozilla.gecko.Experiments;
-import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.util.StringUtils;
import org.mozilla.gecko.util.ViewUtil;
import org.mozilla.gecko.widget.themed.ThemedImageButton;
import org.mozilla.gecko.widget.themed.ThemedLinearLayout;
import org.mozilla.gecko.widget.themed.ThemedTextView;
import android.content.Context;
import android.support.annotation.NonNull;
import android.text.Editable;
import android.text.Spannable;
-import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.ForegroundColorSpan;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.HorizontalScrollView;
-import org.mozilla.gecko.switchboard.SwitchBoard;
-import org.mozilla.gecko.widget.themed.ThemedView;
-
/**
* {@code ToolbarDisplayLayout} is the UI for when the toolbar is in
* display state. It's used to display the state of the currently selected
* tab. It should always be updated through a single entry point
* (updateFromTab) and should never track any tab events or gecko messages
* on its own to keep it as dumb as possible.
*
* The UI has two possible modes: progress and display which are triggered
@@ -133,18 +127,16 @@ public class ToolbarDisplayLayout extend
private static final int LEVEL_SEARCH_ICON = 999;
private final ForegroundColorSpan mUrlColorSpan;
private final ForegroundColorSpan mPrivateUrlColorSpan;
private final ForegroundColorSpan mBlockedColorSpan;
private final ForegroundColorSpan mPrivateBlockedColorSpan;
private final ForegroundColorSpan mDomainColorSpan;
private final ForegroundColorSpan mPrivateDomainColorSpan;
- private final ForegroundColorSpan mCertificateOwnerColorSpan;
- private final ForegroundColorSpan mPrivateCertificateOwnerColorSpan;
public ToolbarDisplayLayout(Context context, AttributeSet attrs) {
super(context, attrs);
setOrientation(HORIZONTAL);
mActivity = (BrowserApp) context;
LayoutInflater.from(context).inflate(R.layout.toolbar_display_layout, this);
@@ -174,18 +166,16 @@ public class ToolbarDisplayLayout extend
getResources().getDisplayMetrics());
mUrlColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_urltext));
mPrivateUrlColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_urltext_private));
mBlockedColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_blockedtext));
mPrivateBlockedColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_blockedtext_private));
mDomainColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_domaintext));
mPrivateDomainColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_domaintext_private));
- mCertificateOwnerColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_certificate_owner));
- mPrivateCertificateOwnerColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_certificate_owner_private));
mSiteSecurity = (ThemedImageButton) findViewById(R.id.site_security);
mSiteIdentityPopup = new SiteIdentityPopup(mActivity);
mSiteIdentityPopup.setAnchor(this);
mSiteIdentityPopup.setOnVisibilityChangeListener(mActivity);
mStop = (ThemedImageButton) findViewById(R.id.stop);
@@ -328,62 +318,32 @@ public class ToolbarDisplayLayout extend
setContentDescription(null);
return;
}
final String baseDomain = tab.getBaseDomain();
String strippedURL = stripAboutReaderURL(url);
- final boolean isHttpOrHttps = StringUtils.isHttpOrHttps(strippedURL);
-
if (mPrefs.shouldTrimUrls()) {
strippedURL = StringUtils.stripCommonSubdomains(StringUtils.stripScheme(strippedURL));
}
// The URL bar does not support RTL currently (See bug 928688 and meta bug 702845).
// Displaying a URL using RTL (or mixed) characters can lead to an undesired reordering
// of elements of the URL. That's why we are forcing the URL to use LTR (bug 1284372).
strippedURL = StringUtils.forceLTR(strippedURL);
// This value is not visible to screen readers but we rely on it when running UI tests. Screen
// readers will instead focus BrowserToolbar and read the "base domain" from there. UI tests
// will read the content description to obtain the full URL for performing assertions.
setContentDescription(strippedURL);
- final SiteIdentity siteIdentity = tab.getSiteIdentity();
- if (siteIdentity.hasOwner() && SwitchBoard.isInExperiment(mActivity, Experiments.URLBAR_SHOW_EV_CERT_OWNER)) {
- // Show Owner of EV certificate as title
- updateTitleFromSiteIdentity(siteIdentity, tab.isPrivate());
- } else if (isHttpOrHttps && !HardwareUtils.isTablet() && !TextUtils.isEmpty(baseDomain)
- && SwitchBoard.isInExperiment(mActivity, Experiments.URLBAR_SHOW_ORIGIN_ONLY)) {
- // Show just the base domain as title
- setTitle(baseDomain);
- } else {
- // Display full URL with base domain highlighted as title
- updateAndColorTitleFromFullURL(strippedURL, baseDomain, tab.isPrivate());
- }
- }
-
- private void updateTitleFromSiteIdentity(SiteIdentity siteIdentity, boolean isPrivate) {
- final String title;
-
- if (siteIdentity.hasCountry()) {
- title = String.format("%s (%s)", siteIdentity.getOwner(), siteIdentity.getCountry());
- } else {
- title = siteIdentity.getOwner();
- }
-
- final SpannableString spannable = new SpannableString(title);
- final ForegroundColorSpan colorSpan = isPrivate
- ? mPrivateCertificateOwnerColorSpan
- : mCertificateOwnerColorSpan;
- spannable.setSpan(colorSpan, 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
-
- setTitle(spannable);
+ // Display full URL with base domain highlighted as title
+ updateAndColorTitleFromFullURL(strippedURL, baseDomain, tab.isPrivate());
}
private void updateAndColorTitleFromFullURL(String url, String baseDomain, boolean isPrivate) {
if (TextUtils.isEmpty(baseDomain)) {
setTitle(url);
return;
}
--- a/mobile/android/app/src/photon/res/values/colors.xml
+++ b/mobile/android/app/src/photon/res/values/colors.xml
@@ -60,18 +60,16 @@
<color name="photon_toolbar_image_tint">@color/photon_toolbar_text_color</color>
<color name="photon_toolbar_image_tint_private">@color/photon_toolbar_text_color_private</color>
<color name="photon_search_item_text">@color/photon_text_main</color>
<color name="photon_search_item_text_private">@color/photon_text_main_private</color>
<color name="photon_url_bar_blocked">#D70022</color>
<color name="photon_url_bar_blocked_private">#D70022</color>
- <color name="photon_url_bar_certificate_owner">#05A700</color>
- <color name="photon_url_bar_certificate_owner_private">#16DA00</color>
<color name="photon_url_bar_domain">@color/photon_text_main</color>
<color name="photon_url_bar_domain_private">@color/photon_text_main_private</color>
<color name="photon_url_bar_bg">#B3FFFFFF</color>
<!-- Tab strip color on tablet -->
<color name="photon_tab_strip_bg">#272727</color>
<!-- Tab strip item color on tablet -->
@@ -225,18 +223,16 @@
<color name="tab_item_thumbnail_default_bg">#E4E4E4</color>
<color name="url_bar_urltext">#737373</color>
<color name="url_bar_urltext_private">#B2B2B2</color>
<color name="url_bar_domaintext">@color/photon_url_bar_domain</color>
<color name="url_bar_domaintext_private">@color/photon_url_bar_domain_private</color>
<color name="url_bar_blockedtext">@color/photon_url_bar_blocked</color>
<color name="url_bar_blockedtext_private">@color/photon_url_bar_blocked_private</color>
- <color name="url_bar_certificate_owner">@color/photon_url_bar_certificate_owner</color>
- <color name="url_bar_certificate_owner_private">@color/photon_url_bar_certificate_owner_private</color>
<color name="url_bar_shadow">#12000000</color>
<color name="panel_image_item_background">#D1D9E1</color>
<color name="panel_icon_item_title_background">#32000000</color>
<color name="panel_tab_text_normal">#FFBFBFBF</color>
<!-- Button toast colors. -->
<color name="toast_background">#DD222222</color>
--- a/mobile/android/base/java/org/mozilla/gecko/Experiments.java
+++ b/mobile/android/base/java/org/mozilla/gecko/Experiments.java
@@ -37,22 +37,16 @@ public class Experiments {
// Promotion for "Add to homescreen"
public static final String PROMOTE_ADD_TO_HOMESCREEN = "promote-add-to-homescreen";
public static final String PREF_ONBOARDING_VERSION = "onboarding_version";
// Promotion to bookmark reader-view items after entering reader view three times (Bug 1247689)
public static final String TRIPLE_READERVIEW_BOOKMARK_PROMPT = "triple-readerview-bookmark-prompt";
- // Only show origin in URL bar instead of full URL (Bug 1236431)
- public static final String URLBAR_SHOW_ORIGIN_ONLY = "urlbar-show-origin-only";
-
- // Show name of organization (EV cert) instead of full URL in URL bar (Bug 1249594).
- public static final String URLBAR_SHOW_EV_CERT_OWNER = "urlbar-show-ev-cert-owner";
-
// Play HLS videos in a VideoView (Bug 1313391)
public static final String HLS_VIDEO_PLAYBACK = "hls-video-playback";
// 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";