Commit 016b6014 authored by Lei Tian's avatar Lei Tian Committed by Commit Bot

Fix bug for emphasizing https scheme for Chrome Home

The recent change for using ColorUtils.isUsingDefaultToolbarColor to
decide emphazing htts scheme makes Chrome Home does not emphasize https
properly. This is because ColorUtils.isUsingDefaultToolbarColor does not
check whether BottomSheet is null. For Chrome Home, BottomSheet is not
null so the toolbar should not be populated by brand color and should
emphasize the https scheme.

To fix the problem, revert back to use ToolbarModel.isUsingBrandColor.
And also change CCT to use the same method. However, since
mIsUsingBrandColor also depends of whether there is a tab, make setTab
in ToolbarModelImpl also update mIsUsingBrandColor. This is needed
because CCT setTab after setPrimaryColor.

BUG=771559

Change-Id: Id94c811f2992ecc73b36c08d2537c63949131f2e
Reviewed-on: https://chromium-review.googlesource.com/701455Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Lei Tian <ltian@google.com>
Cr-Commit-Position: refs/heads/master@{#506806}
parent dc805e13
......@@ -1405,9 +1405,7 @@ public class LocationBarLayout extends FrameLayout
@Override
public boolean shouldEmphasizeHttpsScheme() {
if (!ColorUtils.isUsingDefaultToolbarColor(
getResources(), mToolbarDataProvider.getPrimaryColor())
|| mToolbarDataProvider.isIncognito()) {
if (mToolbarDataProvider.isUsingBrandColor() || mToolbarDataProvider.isIncognito()) {
return false;
}
return true;
......
......@@ -254,8 +254,7 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
@Override
public boolean shouldEmphasizeHttpsScheme() {
return ColorUtils.isUsingDefaultToolbarColor(
getResources(), getToolbarDataProvider().getPrimaryColor());
return !mToolbarDataProvider.isUsingBrandColor();
}
@Override
......
......@@ -69,6 +69,7 @@ class ToolbarModelImpl extends ToolbarModel implements ToolbarDataProvider, Tool
assert tab == null || tab.isIncognito() == isIncognito;
mTab = tab;
mIsIncognito = isIncognito;
updateUsingBrandColor();
}
@Override
......@@ -158,6 +159,10 @@ class ToolbarModelImpl extends ToolbarModel implements ToolbarDataProvider, Tool
*/
public void setPrimaryColor(int color) {
mPrimaryColor = color;
updateUsingBrandColor();
}
private void updateUsingBrandColor() {
Context context = ContextUtils.getApplicationContext();
mIsUsingBrandColor = !isIncognito()
&& mPrimaryColor
......
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