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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarWrapper.java

Issue 1587403002: Max-width, floating infobars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarWrapper.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarWrapper.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarWrapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..8e50fb8d6ee7fa3e02149faae3a3ec61666a9e77
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarWrapper.java
@@ -0,0 +1,40 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.infobar;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.FrameLayout;
+
+import org.chromium.chrome.R;
+
+/**
+ * Layout that holds infobar contents and provides a background color and a top shadow.
gone 2016/01/15 22:48:38 an infobar's contents?
newt (away) 2016/01/15 23:47:33 More better grammar.
+ */
+class InfoBarWrapper extends FrameLayout {
+
+ /**
+ * Constructor for inflating from Java.
+ */
+ InfoBarWrapper(Context context) {
+ super(context);
+ Resources res = context.getResources();
+ int peekingHeight = res.getDimensionPixelSize(R.dimen.infobar_peeking_height);
+ int shadowHeight = res.getDimensionPixelSize(R.dimen.infobar_shadow_height);
+ setMinimumHeight(peekingHeight + shadowHeight);
+
+ // setBackgroundResource() changes the padding, so call setPadding() second.
+ setBackgroundResource(R.drawable.infobar_wrapper_bg);
+ setPadding(0, shadowHeight, 0, 0);
+ }
+
+ @Override
+ public void onViewAdded(View child) {
+ child.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT,
+ Gravity.TOP));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698