OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.infobar; | 5 package org.chromium.chrome.browser.infobar; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.view.Gravity; | 9 import android.view.Gravity; |
10 import android.view.View; | 10 import android.view.View; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 tab.addObserver(mTabObserver); | 182 tab.addObserver(mTabObserver); |
183 mTabView = tab.getView(); | 183 mTabView = tab.getView(); |
184 setSnackbarManagerFromTab(tab); | 184 setSnackbarManagerFromTab(tab); |
185 | 185 |
186 // TODO(newt): move this workaround into the infobar views if/when they'
re scrollable. | 186 // TODO(newt): move this workaround into the infobar views if/when they'
re scrollable. |
187 // Workaround for http://crbug.com/407149. See explanation in onMeasure(
) below. | 187 // Workaround for http://crbug.com/407149. See explanation in onMeasure(
) below. |
188 setVerticalScrollBarEnabled(false); | 188 setVerticalScrollBarEnabled(false); |
189 | 189 |
190 FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( | 190 FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( |
191 LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, Gravity.BO
TTOM); | 191 LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, Gravity.BO
TTOM); |
192 int topMarginDp = DeviceFormFactor.isTablet(context) | 192 int topMarginDp = DeviceFormFactor.isTablet() ? TOP_MARGIN_TABLET_DP : T
OP_MARGIN_PHONE_DP; |
193 ? TOP_MARGIN_TABLET_DP : TOP_MARGIN_PHONE_DP; | |
194 lp.topMargin = Math.round(topMarginDp * getResources().getDisplayMetrics
().density); | 193 lp.topMargin = Math.round(topMarginDp * getResources().getDisplayMetrics
().density); |
195 setLayoutParams(lp); | 194 setLayoutParams(lp); |
196 | 195 |
197 mParentView = parentView; | 196 mParentView = parentView; |
198 | 197 |
199 mLayout = new InfoBarContainerLayout(context); | 198 mLayout = new InfoBarContainerLayout(context); |
200 addView(mLayout, new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, | 199 addView(mLayout, new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, |
201 LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL)); | 200 LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL)); |
202 | 201 |
203 mIPHSupport = new IPHInfoBarSupport(context); | 202 mIPHSupport = new IPHInfoBarSupport(context); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } | 427 } |
429 | 428 |
430 super.onLayout(changed, l, t, r, b); | 429 super.onLayout(changed, l, t, r, b); |
431 } | 430 } |
432 | 431 |
433 private native long nativeInit(); | 432 private native long nativeInit(); |
434 private native void nativeSetWebContents( | 433 private native void nativeSetWebContents( |
435 long nativeInfoBarContainerAndroid, WebContents webContents); | 434 long nativeInfoBarContainerAndroid, WebContents webContents); |
436 private native void nativeDestroy(long nativeInfoBarContainerAndroid); | 435 private native void nativeDestroy(long nativeInfoBarContainerAndroid); |
437 } | 436 } |
OLD | NEW |