New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 826596 link

Starred by 2 users

Issue metadata

Status: Started
Owner:
Long OOO (go/where-is-mgiuca)
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

Audit uses of BrowserView::toolbar() with DesktopPWAWindowing

Project Member Reported by alancutter@chromium.org, Mar 28 2018

Issue description

There are parts of the UI that expect the Chrome's main toolbar UI to be present (example  issue 825554 ).

With HostedAppButtonContainer reusing toolbar button related code we added BrowserViewButtonProvider as a generic button getter that defers to the appropriate "toolbar" view (either HostedAppButtonContainer or ToolbarView).

We need to audit uses of ToolbarView* BrowserView::toolbar() that may need to use BrowserView::button_provider() instead.
 
These are the non-test call sites for BrowserView::toolbar().


Should probably change:

incognito_window_tracker.cc GetAppMenuButton()
https://cs.chromium.org/chromium/src/chrome/browser/feature_engagement/incognito_window/incognito_window_tracker.cc?type=cs&sq=package:chromium&l=33

ExtensionActionPlatformDelegateViews::CloseOverflowMenu()
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/extensions/extension_action_platform_delegate_views.cc?type=cs&sq=package:chromium&l=100

extension_installed_bubble_view.cc AnchorViewForBrowser()
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc?type=cs&sq=package:chromium&l=93

ExtensionInstalledBubble::ShouldShow()
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc?type=cs&sq=package:chromium&l=403

BrowserViewLayout::GetFindBarBoundingBox()
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/frame/browser_view_layout.cc?type=cs&sq=package:chromium&l=247

ImeWarningBubbleView::ImeWarningBubbleView()
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/ime/ime_warning_bubble_view.cc?type=cs&sq=package:chromium&l=100

relaunch_recommended_bubble_view.cc GetAnchor()
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/relaunch_notification/relaunch_recommended_bubble_view.cc?type=cs&sq=package:chromium&l=59

MediaRouterActionPlatformDelegateViews::CloseOverflowMenuIfOpen()
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/toolbar/media_router_action_platform_delegate_views.cc?type=cs&sq=package:chromium&l=37


Should probably stay the same:

BrowserNonClientFrameViewAsh::OnPaint()
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc?type=cs&sq=package:chromium&l=360

OpaqueBrowserFrameView::IsToolbarVisible()
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc?type=cs&sq=package:chromium&l=425

OpaqueBrowserFrameView::PaintClientEdge()
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc?type=cs&sq=package:chromium&l=640


Comment 2 by mgiuca@chromium.org, Mar 28 2018

Cc: alancutter@chromium.org
Owner: mgiuca@chromium.org
I'll take this given that it ties into my refactoring on  Issue 791399 .

Pri-1 because these might be crashes. Will drop the priority once confirmed.

Comment 3 by mgiuca@chromium.org, Apr 12 2018

Audit results:
- incognito_window_tracker.cc: Found weird existing  issue 811982 ; added one more null check and removed assumption that it's non-null. (Note: This file wasn't being compiled in on my local build; it's behind a build flag.)
- extension_action_platform_delegate_views.cc: Already null check.
- extension_installed_bubble_view.cc: Added null check.
- browser_non_client_frame_view_ash.cc: Not accessing property that can be null.
- browser_view_layout.cc: Not accessing property that can be null.
- ime_warning_bubble_view.cc: **outstanding**. Can't be null-checked as the whole thing relies on browser_actions. Should be fixed by using toolbar_button_provider().
- media_router_action_platform_delegate_views.cc: Added null check.
- relaunch_recommended_bubble_view.cc: Not compiled on Chrome OS. **outstanding** Can't be null-checked as it needs a point. Should be fixed by using toolbar_button_provider().
- opaque_browser_frame_view.cc: Not compiled on Chrome OS. Not accessing property that can be null.

This covers all of the files mentioned in #1.

Note that even the ones where a null check was added should be audited again and converted to use toolbar_button_provider. The "**outstanding**" ones above are the ones that might still crash, and we should figure out if that's a possibility.

Also note that this audit really has nothing to do with the Desktop PWAs launch; if any of these are crashy they will have been for some time, in Hosted and Bookmark app windows. So I don't think we should block launch on fixing these, but they should be addressed.

CL to add null checks: https://chromium-review.googlesource.com/#/c/chromium/src/+/1010002
Project Member

Comment 4 by bugdroid1@chromium.org, Apr 12 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8c852c8db3273cf728bdeb36b5ecd152aea8271c

commit 8c852c8db3273cf728bdeb36b5ecd152aea8271c
Author: Matt Giuca <mgiuca@chromium.org>
Date: Thu Apr 12 22:07:54 2018

Added null checks for properties on ToolbarView that can be null.

BrowserView's toolbar() will have null app_menu_button() and
browser_actions() in hosted app windows, which could result in null
dereferences in certain corner cases. This adds null checks where it's
obviously safe to do so.

A better fix would be to use toolbar_button_provider() to access the
hosted app window's real app menu button and actions container, but that
requires more careful consideration.

Bug: 826596,  811982 
Change-Id: Iea0a0ea3acffe5ed1016e61bd8ae2fe36971c79d
Reviewed-on: https://chromium-review.googlesource.com/1010002
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Michael Wasserman <msw@chromium.org>
Commit-Queue: Matt Giuca <mgiuca@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550381}
[modify] https://crrev.com/8c852c8db3273cf728bdeb36b5ecd152aea8271c/chrome/browser/feature_engagement/incognito_window/incognito_window_tracker.cc
[modify] https://crrev.com/8c852c8db3273cf728bdeb36b5ecd152aea8271c/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc
[modify] https://crrev.com/8c852c8db3273cf728bdeb36b5ecd152aea8271c/chrome/browser/ui/views/toolbar/media_router_action_platform_delegate_views.cc

Comment 5 by mgiuca@chromium.org, Apr 12 2018

Labels: -Pri-1 Pri-2
Now the audit is done and null checks landed, dropping pri to 2.

Still keeping M67, because we need to look into ime_warning_bubble_view and see if it can be triggered for hosted app windows (in which case it would be a crash and needs to use toolbar_button_provider).
Labels: -M-67 M-68
67 has branched, moving bugs over to 68.

Comment 7 by mgiuca@chromium.org, Apr 13 2018

Per #5, I want to keep this on 67 in case there's a problem that needs to be merged.

Comment 8 by mgiuca@chromium.org, Apr 13 2018

Labels: -M-68 M-67
Project Member

Comment 9 by bugdroid1@chromium.org, Apr 17 2018

Labels: merge-merged-testbranch
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8c852c8db3273cf728bdeb36b5ecd152aea8271c

commit 8c852c8db3273cf728bdeb36b5ecd152aea8271c
Author: Matt Giuca <mgiuca@chromium.org>
Date: Thu Apr 12 22:07:54 2018

Added null checks for properties on ToolbarView that can be null.

BrowserView's toolbar() will have null app_menu_button() and
browser_actions() in hosted app windows, which could result in null
dereferences in certain corner cases. This adds null checks where it's
obviously safe to do so.

A better fix would be to use toolbar_button_provider() to access the
hosted app window's real app menu button and actions container, but that
requires more careful consideration.

Bug: 826596,  811982 
Change-Id: Iea0a0ea3acffe5ed1016e61bd8ae2fe36971c79d
Reviewed-on: https://chromium-review.googlesource.com/1010002
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Michael Wasserman <msw@chromium.org>
Commit-Queue: Matt Giuca <mgiuca@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550381}
[modify] https://crrev.com/8c852c8db3273cf728bdeb36b5ecd152aea8271c/chrome/browser/feature_engagement/incognito_window/incognito_window_tracker.cc
[modify] https://crrev.com/8c852c8db3273cf728bdeb36b5ecd152aea8271c/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc
[modify] https://crrev.com/8c852c8db3273cf728bdeb36b5ecd152aea8271c/chrome/browser/ui/views/toolbar/media_router_action_platform_delegate_views.cc

Labels: -M-67 M-68
Labels: -M-68 M-69
Bulk punting M68 PWA bugs to M69.

Sign in to add a comment