Straighten up life cycle of native InfoBar pointers
Currently, there are two issues for potential crashes.
1. There is a chance that Java InfoBars can access native counterparts
even after they are destroyed.
mNativeInfoBarPtr is never reset even after native InfoBar is destroyed.
We do not accept touch inputs after closing infobars, but there may be
corner cases where mNativeInfoBarPtr is accessed afterwards.
2. Infobars aren't setting "base" native pointers correctly.
InfoBar_jni.h has the following code:
InfoBarAndroid* native =
reinterpret_cast<InfoBarAndroid*>(nativeInfoBarAndroid);
Here, nativeInfoBarAndroid refers to the subclass, so we implicitly upcast
the pointer using reinterpret_cast<>, which may result in pointing to
an incorrect pointer depending on the architecture.
In order to prevent any such occurrence in the future,
this also prevents InfoBar Java subclasses from accessing
the native base pointer and functions.
BUG=492777, 481758
Review URL: https://codereview.chromium.org/
1150193004
Cr-Commit-Position: refs/heads/master@{#333015}