diff options
author | yfriedman <yfriedman@chromium.org> | 2015-09-02 13:54:56 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-02 20:56:14 +0000 |
commit | 4d978263c720d2accbf1ffa35f859bee9f8e3383 (patch) | |
tree | 8f03744086e33e76cc42fd41b407b126d82a924c /chrome/browser/android/fullscreen | |
parent | 9589e4d0d20aab9b167ac2be3ccfd874af7fafa2 (diff) | |
download | chromium_src-4d978263c720d2accbf1ffa35f859bee9f8e3383.zip chromium_src-4d978263c720d2accbf1ffa35f859bee9f8e3383.tar.gz chromium_src-4d978263c720d2accbf1ffa35f859bee9f8e3383.tar.bz2 |
Speculative hardening of fullscreen infobar code.
While this probably isn't the principle infobar crash, it does have a
few bad smells:
1) InfoBarDelegate's already have an infobar() accessor. Use that
instead of a cached tab instance.
2) Many places in infobar code that handle user events check the
context to ensure they're still valid before handling them but this
didn't.
BUG=481758
Review URL: https://codereview.chromium.org/1322063003
Cr-Commit-Position: refs/heads/master@{#347017}
Diffstat (limited to 'chrome/browser/android/fullscreen')
-rw-r--r-- | chrome/browser/android/fullscreen/fullscreen_infobar_delegate.cc | 7 | ||||
-rw-r--r-- | chrome/browser/android/fullscreen/fullscreen_infobar_delegate.h | 8 |
2 files changed, 7 insertions, 8 deletions
diff --git a/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.cc b/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.cc index 04d0ab3..b7d222d 100644 --- a/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.cc +++ b/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.cc @@ -52,11 +52,10 @@ FullscreenInfoBarDelegate::~FullscreenInfoBarDelegate() { } void FullscreenInfoBarDelegate::CloseFullscreenInfoBar( - JNIEnv* env, jobject obj, jobject tab) { + JNIEnv* env, jobject obj) { j_delegate_.Reset(); - TabAndroid* tab_android = TabAndroid::GetNativeTab(env, tab); - InfoBarService::FromWebContents(tab_android->web_contents())->RemoveInfoBar( - infobar()); + if (infobar() && infobar()->owner()) + infobar()->owner()->RemoveInfoBar(infobar()); } int FullscreenInfoBarDelegate::GetIconID() const { diff --git a/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.h b/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.h index 0ec2968..4373041 100644 --- a/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.h +++ b/chrome/browser/android/fullscreen/fullscreen_infobar_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_ANDROID_FULLSCREEN_INFOBAR_DELEGATE_H_ -#define CHROME_BROWSER_ANDROID_FULLSCREEN_INFOBAR_DELEGATE_H_ +#ifndef CHROME_BROWSER_ANDROID_FULLSCREEN_FULLSCREEN_INFOBAR_DELEGATE_H_ +#define CHROME_BROWSER_ANDROID_FULLSCREEN_FULLSCREEN_INFOBAR_DELEGATE_H_ #include <string> @@ -24,7 +24,7 @@ class FullscreenInfoBarDelegate : public ConfirmInfoBarDelegate { ~FullscreenInfoBarDelegate() override; // Called to close the infobar. - void CloseFullscreenInfoBar(JNIEnv* env, jobject obj, jobject tab); + void CloseFullscreenInfoBar(JNIEnv* env, jobject obj); // ConfirmInfoBarDelegate: int GetIconID() const override; @@ -40,4 +40,4 @@ class FullscreenInfoBarDelegate : public ConfirmInfoBarDelegate { DISALLOW_COPY_AND_ASSIGN(FullscreenInfoBarDelegate); }; -#endif // CHROME_BROWSER_ANDROID_FULLSCREEN_INFOBAR_DELEGATE_H_ +#endif // CHROME_BROWSER_ANDROID_FULLSCREEN_FULLSCREEN_INFOBAR_DELEGATE_H_ |