Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java |
index da2234d7509b8cdf7b6a09670c3321e4f43edfe6..e0b5adf39ca4902754960d9b07d754f060231ece 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java |
@@ -37,6 +37,9 @@ public class NewTabPageLayout extends BoundedLinearLayout { |
private View mBottomSpacer; |
private View mScrollCompensationSpacer; |
+ private LogoView mSearchProviderLogoView; |
+ private int mMostVisitedWidth; |
+ |
/** |
* Constructor for inflating from XML. |
*/ |
@@ -56,6 +59,7 @@ public class NewTabPageLayout extends BoundedLinearLayout { |
mMiddleSpacer = findViewById(R.id.ntp_middle_spacer); |
mBottomSpacer = findViewById(R.id.ntp_bottom_spacer); |
mScrollCompensationSpacer = findViewById(R.id.ntp_scroll_spacer); |
+ mSearchProviderLogoView = (LogoView) findViewById(R.id.search_provider_logo); |
} |
/** |
@@ -71,6 +75,16 @@ public class NewTabPageLayout extends BoundedLinearLayout { |
mParentScrollViewportHeight = height; |
} |
+ /** |
+ * Set the width of the most visited sites view. This is needed so the logo can be resized to |
+ * exactly the same size as the most visited sites view. |
+ * |
+ * @param width of the most visited sites view as extracted using MeasureSpec.getSize() |
+ */ |
+ public void setMostVisitedWidth(int width) { |
+ mMostVisitedWidth = width; |
+ } |
+ |
@Override |
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
mScrollCompensationSpacer.getLayoutParams().height = 0; |
@@ -107,6 +121,13 @@ public class NewTabPageLayout extends BoundedLinearLayout { |
} else { |
mScrollCompensationSpacer.setVisibility(View.GONE); |
} |
+ |
+ // Make the search box and logo as wide as the most visited items |
+ int mostVisitedWidthSpec = |
+ MeasureSpec.makeMeasureSpec(mMostVisitedWidth, MeasureSpec.EXACTLY); |
+ int logoHeight = MeasureSpec.makeMeasureSpec( |
+ mSearchProviderLogoView.getMeasuredHeight(), MeasureSpec.EXACTLY); |
+ mSearchProviderLogoView.measure(mostVisitedWidthSpec, logoHeight); |
} |
/** |