Commit b7488d26 authored by Anna Malova's avatar Anna Malova Committed by Commit Bot

Add content description for the security icon based on the security level

Bug: 849861
Change-Id: Ia09b1c41f7a631502e14cf29509d6908d8eb7eac
Reviewed-on: https://chromium-review.googlesource.com/1092747
Commit-Queue: Anna Malova <amalova@chromium.org>
Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577608}
parent 149e07a1
......@@ -29,7 +29,6 @@
android:layout_gravity="center"
android:alpha="0"
android:visibility="invisible"
android:contentDescription="@string/accessibility_toolbar_btn_site_info"
app:chrometint="@color/dark_mode_tint" />
</FrameLayout>
......
......@@ -25,7 +25,6 @@
android:layout_width="@dimen/location_bar_icon_width"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:contentDescription="@string/accessibility_toolbar_btn_site_info"
android:scaleType="center"
android:visibility="invisible"
app:chrometint="@color/dark_mode_tint" />
......
......@@ -42,7 +42,6 @@
android:layout_gravity="center"
android:alpha="0"
android:visibility="invisible"
android:contentDescription="@string/accessibility_toolbar_btn_site_info"
app:chrometint="@color/dark_mode_tint" />
</FrameLayout>
......
......@@ -1042,6 +1042,10 @@ public class LocationBarLayout extends FrameLayout
mSecurityButton.setTint(mToolbarDataProvider.getSecurityIconColorStateList());
}
int contentDescriptionId = getToolbarDataProvider().getSecurityIconContentDescription();
String contentDescription = getContext().getString(contentDescriptionId);
mSecurityButton.setContentDescription(contentDescription);
updateVerboseStatusVisibility();
if (mSecurityIconResource == id && mLocationBarButtonType == getLocationBarButtonToShow()) {
......
......@@ -532,6 +532,10 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
mAnimDelegate.showSecurityButton();
}
int contentDescriptionId = getToolbarDataProvider().getSecurityIconContentDescription();
String contentDescription = getContext().getString(contentDescriptionId);
mSecurityButton.setContentDescription(contentDescription);
setUrlToPageUrl();
mUrlBar.invalidate();
}
......
......@@ -8,7 +8,9 @@ import android.content.res.ColorStateList;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ntp.NewTabPage;
import org.chromium.chrome.browser.omnibox.UrlBarData;
import org.chromium.chrome.browser.profiles.Profile;
......@@ -99,6 +101,27 @@ public interface ToolbarDataProvider {
@DrawableRes
int getSecurityIconResource(boolean isTablet);
/**
* @return The resource ID of the content description for the security icon.
*/
@StringRes
default int getSecurityIconContentDescription() {
switch (getSecurityLevel()) {
case ConnectionSecurityLevel.NONE:
case ConnectionSecurityLevel.HTTP_SHOW_WARNING:
return R.string.accessibility_security_btn_warn;
case ConnectionSecurityLevel.DANGEROUS:
return R.string.accessibility_security_btn_dangerous;
case ConnectionSecurityLevel.SECURE_WITH_POLICY_INSTALLED_CERT:
case ConnectionSecurityLevel.SECURE:
case ConnectionSecurityLevel.EV_SECURE:
return R.string.accessibility_security_btn_secure;
default:
assert false;
}
return 0;
}
/**
* @return The {@link ColorStateList} to use to tint the security state icon.
*/
......
......@@ -3029,9 +3029,18 @@ To obtain new licenses, connect to the internet and play your downloaded content
<message name="IDS_ACCESSIBILITY_TOOLBAR_BTN_MENU_UPDATE" desc="Content description for the menu button when it is covered by the update icon that is displayed when a newer version of Chrome is available.">
Update available. More options
</message>
<message name="IDS_ACCESSIBILITY_TOOLBAR_BTN_SITE_INFO" desc="Content description for the page icon that gives more site information when clicked. The icon can be a lock for secure pages, a magnifier for search result pages, or other icons representing the page state.">
<message name="IDS_ACCESSIBILITY_TOOLBAR_BTN_SITE_INFO" desc="Content description for the page icon that gives more site information when clicked. The icon can be a magnifier for search result pages, or other icons representing the page state.">
Site information
</message>
<message name="IDS_ACCESSIBILITY_SECURITY_BTN_WARN" desc="Content description for the security icon for pages with insecure passive content. The content description also includes the call to action for opening the page info bubble (Site information).">
Your connection to this site is not secure. Site information
</message>
<message name="IDS_ACCESSIBILITY_SECURITY_BTN_SECURE" desc="Content description for the security icon for pages with a valid certificate. The content description also includes the call to action for opening the page info bubble (Site information).">
Connection is secure. Site information
</message>
<message name="IDS_ACCESSIBILITY_SECURITY_BTN_DANGEROUS" desc="Content description for the security icon for dangerous pages. The content description also includes the call to action for opening the page info bubble (Site information).">
This page is dangerous. Site information
</message>
<message name="IDS_ACCESSIBILITY_TOOLBAR_BTN_MIC" desc="Content description for the voice search button.">
Start voice search
</message>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment