Commit 2c2a9896 authored by Pavel Yatsuk's avatar Pavel Yatsuk Committed by Commit Bot

[Modularization] Remove call to InfoBar#getNativeInfoBarPtr from InfoBarContainer

InfoBar#getNativeInfoBarPtr shouldn't be exposed in general. In this
case it was only used to get to top infobar's identifier. Replacing the
call with more targeted method.

BUG=1056346
R=mdjones@chromium.org

Change-Id: Ia2115a44a4badf5eec93ed858a49fa9bc7688c78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2108918Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Pavel Yatsuk <pavely@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751511}
parent ac95be25
......@@ -390,13 +390,13 @@ public class InfoBarContainer implements UserData, KeyboardVisibilityListener, I
}
/**
* @return Pointer to the native InfoBarAndroid object which is currently at the top of the
* infobar stack, or 0 if there are no infobars.
* @return InfoBarIdentifier of the InfoBar which is currently at the top of the infobar stack,
* or InfoBarIdentifier.INVALID if there are no infobars.
*/
@CalledByNative
private long getTopNativeInfoBarPtr() {
if (!hasInfoBars()) return 0;
return mInfoBars.get(0).getNativeInfoBarPtr();
private @InfoBarIdentifier int getTopInfoBarIdentifier() {
if (!hasInfoBars()) return InfoBarIdentifier.INVALID;
return mInfoBars.get(0).getInfoBarIdentifier();
}
/**
......
......@@ -68,13 +68,12 @@ void InfoBarContainerAndroid::AttachJavaInfoBar(InfoBarAndroid* android_bar) {
env, weak_java_infobar_container_.get(env))) {
base::UmaHistogramSparse("InfoBar.Shown.Hidden",
android_bar->delegate()->GetIdentifier());
uintptr_t native_ptr = Java_InfoBarContainer_getTopNativeInfoBarPtr(
env, weak_java_infobar_container_.get(env));
if (native_ptr) {
base::UmaHistogramSparse("InfoBar.Shown.Hiding",
reinterpret_cast<InfoBarAndroid*>(native_ptr)
->delegate()
->GetIdentifier());
infobars::InfoBarDelegate::InfoBarIdentifier identifier =
static_cast<infobars::InfoBarDelegate::InfoBarIdentifier>(
Java_InfoBarContainer_getTopInfoBarIdentifier(
env, weak_java_infobar_container_.get(env)));
if (identifier != infobars::InfoBarDelegate::InfoBarIdentifier::INVALID) {
base::UmaHistogramSparse("InfoBar.Shown.Hiding", identifier);
}
} else {
base::UmaHistogramSparse("InfoBar.Shown.Visible",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment