Commit c05b50ee authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

ZoomBubbleView: fix crash when web contents is destroyed/unloaded.

In some cases in this class, we already return early if no Browser is
found for the web contents. This updates one callsite of
FindBrowserWithWebContents with an early return, and another with
a DCHECK.

See also crbug.com/737346

Bug: 971468
Change-Id: I04bbc26679d96f58c7a6d6402cde4bec1409375b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1649374
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#668410}
parent 459b7d5e
......@@ -314,10 +314,12 @@ ZoomBubbleView::~ZoomBubbleView() {
base::string16 ZoomBubbleView::GetAccessibleWindowTitle() const {
Browser* browser = chrome::FindBrowserWithWebContents(web_contents());
if (!browser)
return {};
OmniboxPageActionIconContainerView* page_action_icon_container_view =
GetAnchorViewForBrowser(browser);
if (!page_action_icon_container_view)
return base::string16();
return {};
PageActionIconView* zoom_view =
page_action_icon_container_view->GetPageActionIconView(
......@@ -505,6 +507,7 @@ void ZoomBubbleView::ButtonPressed(views::Button* sender,
if (sender == image_button_) {
DCHECK(extension_info_.icon_image) << "Invalid button press.";
Browser* browser = chrome::FindBrowserWithWebContents(web_contents());
DCHECK(browser);
chrome::AddSelectedTabWithURL(
browser, GURL(base::StringPrintf("chrome://extensions?id=%s",
extension_info_.id.c_str())),
......
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