Commit a1e038fe authored by Lei Tian's avatar Lei Tian Committed by Commit Bot

Change logic for deciding whether emphasizing the https scheme.

Both LocationBarLayout and CustomTabToolbar will emphasize the https
scheme if the toolbar uses the defualt color theme.

BUG=726565

Change-Id: I9d9ed97a1a245cf8262fa43008cee5184e1657ca
Reviewed-on: https://chromium-review.googlesource.com/676199
Commit-Queue: Lei Tian <ltian@google.com>
Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504489}
parent d106af77
......@@ -1403,7 +1403,9 @@ public class LocationBarLayout extends FrameLayout
@Override
public boolean shouldEmphasizeHttpsScheme() {
if (mToolbarDataProvider.isUsingBrandColor() || mToolbarDataProvider.isIncognito()) {
if (!ColorUtils.isUsingDefaultToolbarColor(
getResources(), mToolbarDataProvider.getPrimaryColor())
|| mToolbarDataProvider.isIncognito()) {
return false;
}
return true;
......
......@@ -254,9 +254,8 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
@Override
public boolean shouldEmphasizeHttpsScheme() {
int securityLevel = getSecurityLevel();
return securityLevel == ConnectionSecurityLevel.DANGEROUS
|| securityLevel == ConnectionSecurityLevel.SECURE_WITH_POLICY_INSTALLED_CERT;
return ColorUtils.isUsingDefaultToolbarColor(
getResources(), getToolbarDataProvider().getPrimaryColor());
}
@Override
......
......@@ -824,6 +824,7 @@ public class CustomTabActivityTest {
"A custom tab toolbar is never shown", toolbarView instanceof CustomTabToolbar);
CustomTabToolbar toolbar = (CustomTabToolbar) toolbarView;
Assert.assertEquals(expectedColor, toolbar.getBackground().getColor());
Assert.assertFalse(toolbar.shouldEmphasizeHttpsScheme());
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
Assert.assertEquals(ColorUtils.getDarkenedColorForStatusBar(expectedColor),
mCustomTabActivityTestRule.getActivity().getWindow().getStatusBarColor());
......
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