OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.toolbar; | 5 package org.chromium.chrome.browser.toolbar; |
6 | 6 |
7 import android.animation.Animator; | 7 import android.animation.Animator; |
8 import android.animation.AnimatorListenerAdapter; | 8 import android.animation.AnimatorListenerAdapter; |
9 import android.animation.AnimatorSet; | 9 import android.animation.AnimatorSet; |
10 import android.animation.ObjectAnimator; | 10 import android.animation.ObjectAnimator; |
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1980 && isVisualStateValidForBrandColorTransition(newVisualState)) { | 1980 && isVisualStateValidForBrandColorTransition(newVisualState)) { |
1981 return; | 1981 return; |
1982 } else if (mBrandColorTransitionAnimation != null | 1982 } else if (mBrandColorTransitionAnimation != null |
1983 && mBrandColorTransitionAnimation.isRunning()) { | 1983 && mBrandColorTransitionAnimation.isRunning()) { |
1984 mBrandColorTransitionAnimation.cancel(); | 1984 mBrandColorTransitionAnimation.cancel(); |
1985 } | 1985 } |
1986 | 1986 |
1987 boolean visualStateChanged = mVisualState != newVisualState; | 1987 boolean visualStateChanged = mVisualState != newVisualState; |
1988 | 1988 |
1989 int currentPrimaryColor = getToolbarDataProvider().getPrimaryColor(); | 1989 int currentPrimaryColor = getToolbarDataProvider().getPrimaryColor(); |
1990 int themeColorForProgressBar = currentPrimaryColor; | |
1991 | |
1992 // If The page is native force the use of the standard theme for the pro gress bar. | |
1993 if (getToolbarDataProvider() != null && getToolbarDataProvider().getTab( ) != null | |
1994 && getToolbarDataProvider().getTab().isNativePage()) { | |
1995 themeColorForProgressBar = getToolbarColorForVisualState(VisualState .NORMAL); | |
Ted C
2016/06/24 16:19:06
What happens if you're on the incognito ntp?
mdjones
2016/06/24 17:05:28
The incognito flag is still passed into the functi
Ted C
2016/06/24 17:35:43
Acknowledged.
| |
1996 } | |
1997 | |
1990 if (mVisualState == VisualState.BRAND_COLOR && !visualStateChanged) { | 1998 if (mVisualState == VisualState.BRAND_COLOR && !visualStateChanged) { |
1991 boolean useLightToolbarDrawables = | 1999 boolean useLightToolbarDrawables = |
1992 ColorUtils.shouldUseLightForegroundOnBackground(currentPrima ryColor); | 2000 ColorUtils.shouldUseLightForegroundOnBackground(currentPrima ryColor); |
1993 boolean unfocusedLocationBarUsesTransparentBg = | 2001 boolean unfocusedLocationBarUsesTransparentBg = |
1994 !ColorUtils.shouldUseOpaqueTextboxBackground(currentPrimaryC olor); | 2002 !ColorUtils.shouldUseOpaqueTextboxBackground(currentPrimaryC olor); |
1995 if (useLightToolbarDrawables != mUseLightToolbarDrawables | 2003 if (useLightToolbarDrawables != mUseLightToolbarDrawables |
1996 || unfocusedLocationBarUsesTransparentBg | 2004 || unfocusedLocationBarUsesTransparentBg |
1997 != mUnfocusedLocationBarUsesTransparentBg) { | 2005 != mUnfocusedLocationBarUsesTransparentBg) { |
1998 visualStateChanged = true; | 2006 visualStateChanged = true; |
1999 } else { | 2007 } else { |
2000 updateToolbarBackground(VisualState.BRAND_COLOR); | 2008 updateToolbarBackground(VisualState.BRAND_COLOR); |
2001 getProgressBar().setThemeColor(currentPrimaryColor, isIncognito( )); | 2009 getProgressBar().setThemeColor(themeColorForProgressBar, isIncog nito()); |
2002 } | 2010 } |
2003 } | 2011 } |
2004 | 2012 |
2005 mVisualState = newVisualState; | 2013 mVisualState = newVisualState; |
2006 | 2014 |
2007 updateOverlayDrawables(isInTabSwitcherMode); | 2015 updateOverlayDrawables(isInTabSwitcherMode); |
2008 updateShadowVisibility(isInTabSwitcherMode); | 2016 updateShadowVisibility(isInTabSwitcherMode); |
2009 if (!visualStateChanged) { | 2017 if (!visualStateChanged) { |
2010 if (mVisualState == VisualState.NEW_TAB_NORMAL) { | 2018 if (mVisualState == VisualState.NEW_TAB_NORMAL) { |
2011 updateNtpTransitionAnimation( | 2019 updateNtpTransitionAnimation( |
2012 getToolbarDataProvider().getNewTabPageForCurrentTab()); | 2020 getToolbarDataProvider().getNewTabPageForCurrentTab()); |
2013 } | 2021 } |
2014 return; | 2022 return; |
2015 } | 2023 } |
2016 | 2024 |
2017 mUseLightToolbarDrawables = false; | 2025 mUseLightToolbarDrawables = false; |
2018 mUnfocusedLocationBarUsesTransparentBg = false; | 2026 mUnfocusedLocationBarUsesTransparentBg = false; |
2019 mUrlBackgroundAlpha = 255; | 2027 mUrlBackgroundAlpha = 255; |
2020 updateToolbarBackground(mVisualState); | 2028 updateToolbarBackground(mVisualState); |
2021 getProgressBar().setThemeColor(currentPrimaryColor, isIncognito()); | 2029 getProgressBar().setThemeColor(themeColorForProgressBar, isIncognito()); |
2022 | 2030 |
2023 if (isInTabSwitcherMode) { | 2031 if (isInTabSwitcherMode) { |
2024 mUseLightToolbarDrawables = true; | 2032 mUseLightToolbarDrawables = true; |
2025 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; | 2033 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; |
2026 getProgressBar().setBackgroundColor(mProgressBackBackgroundColorWhit e); | 2034 getProgressBar().setBackgroundColor(mProgressBackBackgroundColorWhit e); |
2027 getProgressBar().setForegroundColor(ApiCompatibilityUtils.getColor(g etResources(), | 2035 getProgressBar().setForegroundColor(ApiCompatibilityUtils.getColor(g etResources(), |
2028 R.color.progress_bar_foreground_white)); | 2036 R.color.progress_bar_foreground_white)); |
2029 } else if (isIncognito()) { | 2037 } else if (isIncognito()) { |
2030 mUseLightToolbarDrawables = true; | 2038 mUseLightToolbarDrawables = true; |
2031 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; | 2039 mUrlBackgroundAlpha = LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2209 }); | 2217 }); |
2210 | 2218 |
2211 if (mFullscreenManager != null) { | 2219 if (mFullscreenManager != null) { |
2212 mFullscreenCalloutToken = | 2220 mFullscreenCalloutToken = |
2213 mFullscreenManager.showControlsPersistentAndClearOldToken( | 2221 mFullscreenManager.showControlsPersistentAndClearOldToken( |
2214 mFullscreenCalloutToken); | 2222 mFullscreenCalloutToken); |
2215 } | 2223 } |
2216 } | 2224 } |
2217 } | 2225 } |
2218 | 2226 |
OLD | NEW |