Commit 361fd72f authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Handle display mode in GetToolbarActionViewForId

When the toolbar's display mode is not ::NORMAL the extensions container
is never initialized. Not checking for this (or container availability)
leads to crashes when the extension-uninstall dialog tries to find where
to anchor to in the window.

This intentionally checks the display mode instead of container
availability as the containers should always be created in ::NORMAL.

Bug: chromium:1005154
Change-Id: I5c51bf0f2a02c75896355ccee39077d6c55a0d3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1809974
Commit-Queue: Peter Boström <pbos@chromium.org>
Commit-Queue: Caroline Rising <corising@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Reviewed-by: default avatarCaroline Rising <corising@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697669}
parent 89a693b5
......@@ -802,8 +802,13 @@ BrowserActionsContainer* ToolbarView::GetBrowserActionsContainer() {
ToolbarActionView* ToolbarView::GetToolbarActionViewForId(
const std::string& id) {
if (extensions_container_)
if (display_mode_ != DisplayMode::NORMAL)
return nullptr;
if (base::FeatureList::IsEnabled(features::kExtensionsToolbarMenu)) {
DCHECK(extensions_container_);
return extensions_container_->GetViewForId(id);
}
DCHECK(GetBrowserActionsContainer());
return GetBrowserActionsContainer()->GetViewForId(id);
}
......
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