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 ...@@ -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 * @return InfoBarIdentifier of the InfoBar which is currently at the top of the infobar stack,
* infobar stack, or 0 if there are no infobars. * or InfoBarIdentifier.INVALID if there are no infobars.
*/ */
@CalledByNative @CalledByNative
private long getTopNativeInfoBarPtr() { private @InfoBarIdentifier int getTopInfoBarIdentifier() {
if (!hasInfoBars()) return 0; if (!hasInfoBars()) return InfoBarIdentifier.INVALID;
return mInfoBars.get(0).getNativeInfoBarPtr(); return mInfoBars.get(0).getInfoBarIdentifier();
} }
/** /**
......
...@@ -68,13 +68,12 @@ void InfoBarContainerAndroid::AttachJavaInfoBar(InfoBarAndroid* android_bar) { ...@@ -68,13 +68,12 @@ void InfoBarContainerAndroid::AttachJavaInfoBar(InfoBarAndroid* android_bar) {
env, weak_java_infobar_container_.get(env))) { env, weak_java_infobar_container_.get(env))) {
base::UmaHistogramSparse("InfoBar.Shown.Hidden", base::UmaHistogramSparse("InfoBar.Shown.Hidden",
android_bar->delegate()->GetIdentifier()); android_bar->delegate()->GetIdentifier());
uintptr_t native_ptr = Java_InfoBarContainer_getTopNativeInfoBarPtr( infobars::InfoBarDelegate::InfoBarIdentifier identifier =
env, weak_java_infobar_container_.get(env)); static_cast<infobars::InfoBarDelegate::InfoBarIdentifier>(
if (native_ptr) { Java_InfoBarContainer_getTopInfoBarIdentifier(
base::UmaHistogramSparse("InfoBar.Shown.Hiding", env, weak_java_infobar_container_.get(env)));
reinterpret_cast<InfoBarAndroid*>(native_ptr) if (identifier != infobars::InfoBarDelegate::InfoBarIdentifier::INVALID) {
->delegate() base::UmaHistogramSparse("InfoBar.Shown.Hiding", identifier);
->GetIdentifier());
} }
} else { } else {
base::UmaHistogramSparse("InfoBar.Shown.Visible", 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