Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java

Issue 1417353003: Move UrlBar background drawing to CC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add javadoc Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 (int) (Math.pow(mPhoneLocationBar.getAlpha(), 3) * backg roundAlpha); 1036 (int) (Math.pow(mPhoneLocationBar.getAlpha(), 3) * backg roundAlpha);
1037 } else if (getToolbarDataProvider().isUsingBrandColor() 1037 } else if (getToolbarDataProvider().isUsingBrandColor()
1038 && !mBrandColorTransitionActive) { 1038 && !mBrandColorTransitionActive) {
1039 int unfocusedAlpha = mUnfocusedLocationBarUsesTransparentBg 1039 int unfocusedAlpha = mUnfocusedLocationBarUsesTransparentBg
1040 ? LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA : 255; 1040 ? LOCATION_BAR_TRANSPARENT_BACKGROUND_ALPHA : 255;
1041 backgroundAlpha = 1041 backgroundAlpha =
1042 (int) (mUrlExpansionPercent * (255 - unfocusedAlpha) + u nfocusedAlpha); 1042 (int) (mUrlExpansionPercent * (255 - unfocusedAlpha) + u nfocusedAlpha);
1043 } 1043 }
1044 mLocationBarBackground.setAlpha(backgroundAlpha); 1044 mLocationBarBackground.setAlpha(backgroundAlpha);
1045 1045
1046 if (mPhoneLocationBar.getAlpha() > 0 || mForceDrawLocationBarBackgro und) { 1046 if ((mPhoneLocationBar.getAlpha() > 0 || mForceDrawLocationBarBackgr ound)
1047 && !mTextureCaptureMode) {
1047 mLocationBarBackground.setBounds( 1048 mLocationBarBackground.setBounds(
1048 mUrlViewportBounds.left + mLocationBarBackgroundOffset.l eft, 1049 mUrlViewportBounds.left + mLocationBarBackgroundOffset.l eft,
1049 mUrlViewportBounds.top + mLocationBarBackgroundOffset.to p, 1050 mUrlViewportBounds.top + mLocationBarBackgroundOffset.to p,
1050 mUrlViewportBounds.right + mLocationBarBackgroundOffset. right, 1051 mUrlViewportBounds.right + mLocationBarBackgroundOffset. right,
1051 mUrlViewportBounds.bottom + mLocationBarBackgroundOffset .bottom); 1052 mUrlViewportBounds.bottom + mLocationBarBackgroundOffset .bottom);
1052 mLocationBarBackground.draw(canvas); 1053 mLocationBarBackground.draw(canvas);
1053 } 1054 }
1054 1055
1055 locationBarClipLeft = mUrlViewportBounds.left + mPhoneLocationBar.ge tPaddingLeft() 1056 locationBarClipLeft = mUrlViewportBounds.left + mPhoneLocationBar.ge tPaddingLeft()
1056 + mLocationBarBackgroundOffset.left; 1057 + mLocationBarBackgroundOffset.left;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 } 1165 }
1165 } 1166 }
1166 1167
1167 @Override 1168 @Override
1168 public void getLocationBarContentRect(Rect outRect) { 1169 public void getLocationBarContentRect(Rect outRect) {
1169 if (isLocationBarShownInNTP() && !isFocused()) { 1170 if (isLocationBarShownInNTP() && !isFocused()) {
1170 outRect.setEmpty(); 1171 outRect.setEmpty();
1171 return; 1172 return;
1172 } 1173 }
1173 1174
1174 super.getLocationBarContentRect(outRect); 1175 Rect padding = new Rect();
1176 mLocationBarBackground.getPadding(padding);
1177
1178 outRect.set(mUrlViewportBounds.left + mLocationBarBackgroundOffset.left + padding.left,
1179 mUrlViewportBounds.top + mLocationBarBackgroundOffset.top + padd ing.top,
1180 mUrlViewportBounds.right + mLocationBarBackgroundOffset.right - padding.right,
1181 mUrlViewportBounds.bottom + mLocationBarBackgroundOffset.bottom - padding.bottom);
1175 } 1182 }
1176 1183
1177 @Override 1184 @Override
1178 protected void onHomeButtonUpdate(boolean homeButtonEnabled) { 1185 protected void onHomeButtonUpdate(boolean homeButtonEnabled) {
1179 if (homeButtonEnabled) { 1186 if (homeButtonEnabled) {
1180 mHomeButton.setVisibility(urlHasFocus() || mInTabSwitcherMode ? INVI SIBLE : VISIBLE); 1187 mHomeButton.setVisibility(urlHasFocus() || mInTabSwitcherMode ? INVI SIBLE : VISIBLE);
1181 if (!mBrowsingModeViews.contains(mHomeButton)) { 1188 if (!mBrowsingModeViews.contains(mHomeButton)) {
1182 mBrowsingModeViews.add(mHomeButton); 1189 mBrowsingModeViews.add(mHomeButton);
1183 } 1190 }
1184 } else { 1191 } else {
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 1925
1919 getMenuButton().setVisibility(shouldShowMenuButton() ? View.VISIBLE : Vi ew.GONE); 1926 getMenuButton().setVisibility(shouldShowMenuButton() ? View.VISIBLE : Vi ew.GONE);
1920 } 1927 }
1921 1928
1922 @Override 1929 @Override
1923 public LocationBar getLocationBar() { 1930 public LocationBar getLocationBar() {
1924 return mPhoneLocationBar; 1931 return mPhoneLocationBar;
1925 } 1932 }
1926 } 1933 }
1927 1934
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698