Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Issue 653843002: Mac: Attach Extension NSViews to the view hierarchy before creating renderers (Closed)

Created:
6 years, 2 months ago by tapted
Modified:
5 years, 10 months ago
Reviewers:
Robert Sesek, Finnur
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mac: Attach Extension NSViews to the view hierarchy before creating renderers Extensions with background pages (e.g. Google Cast) currently have a shorter code path when showing an extension popup that can cause the renderer to ask for screen metrics before the hosting NSView is added to the view hierarchy. Since the NSWindow is nil in this case, screen metrics for the primary screen are used, and they may be the incorrect screen for the popup. On non-Mac, toolkit-views platforms get around this problem by deferring creation until View::ViewHierarchyChanged is triggered. However, there is no NSView apart from the render view on the extension-side on Mac, so to do the same we'd either need to add one (and keep it sized appropriately), or modify the WebContents view itself to override [NSView viewDid/WillMoveToSuperview] and feed it through to embedders. Instead, this CL tweaks the ExtensionPopupController initialization to always create the popup NSWindow (initially hidden), before creating the ExtensionViewHost. BUG=324748, 305620 TEST=On a retina mac, plug in a (non-retina) external monitor, move Chrome there, and open the Chromecast dialog. It should look "nice" (not as nice as the retina screen, but consistent with other text in Chrome). See http://crbug.com/324748#c41 Committed: https://crrev.com/836dc7a4b828bffdd351db39cb3738ad36dba332 Cr-Commit-Position: refs/heads/master@{#317011}

Patch Set 1 #

Patch Set 2 : Remove Init() #

Patch Set 3 : rebase #

Patch Set 4 : fix test #

Total comments: 6

Patch Set 5 : respond to comments #

Total comments: 2

Patch Set 6 : fix probably uaf #

Patch Set 7 : add dcheck #

Total comments: 1

Patch Set 8 : Remove DCHECK #

Unified diffs Side-by-side diffs Delta from patch set Stats (+64 lines, -77 lines) Patch
M chrome/browser/extensions/extension_view.h View 1 1 chunk +0 lines, -3 lines 0 comments Download
M chrome/browser/extensions/extension_view_host.cc View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm View 1 2 3 4 5 6 7 6 chunks +58 lines, -59 lines 0 comments Download
M chrome/browser/ui/cocoa/extensions/extension_view_mac.h View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/ui/cocoa/extensions/extension_view_mac.mm View 1 2 2 chunks +3 lines, -6 lines 0 comments Download
M chrome/browser/ui/views/extensions/extension_view_views.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/views/extensions/extension_view_views.cc View 1 2 1 chunk +0 lines, -4 lines 0 comments Download

Messages

Total messages: 18 (5 generated)
tapted
Hi finnur and robert, please take a look https://codereview.chromium.org/653843002/diff/80001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm File chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm (left): https://codereview.chromium.org/653843002/diff/80001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm#oldcode189 chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm:189: [view ...
5 years, 10 months ago (2015-02-18 06:00:11 UTC) #3
Finnur
Non-cocoa code: LGTM.
5 years, 10 months ago (2015-02-18 09:51:58 UTC) #4
Robert Sesek
https://codereview.chromium.org/653843002/diff/80001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm File chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm (right): https://codereview.chromium.org/653843002/diff/80001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm#newcode177 chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm:177: - (void)setExtensionViewHost:(scoped_ptr<extensions::ExtensionViewHost>)host { This method should be down around ...
5 years, 10 months ago (2015-02-18 14:56:20 UTC) #5
tapted
https://codereview.chromium.org/653843002/diff/80001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm File chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm (right): https://codereview.chromium.org/653843002/diff/80001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm#newcode177 chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm:177: - (void)setExtensionViewHost:(scoped_ptr<extensions::ExtensionViewHost>)host { On 2015/02/18 14:56:20, Robert Sesek wrote: ...
5 years, 10 months ago (2015-02-18 22:35:28 UTC) #7
Robert Sesek
https://codereview.chromium.org/653843002/diff/100001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm File chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm (right): https://codereview.chromium.org/653843002/diff/100001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm#newcode263 chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm:263: if (extension_id == host->extension_id()) Actually, will -close also destruct ...
5 years, 10 months ago (2015-02-18 22:38:02 UTC) #8
tapted
https://codereview.chromium.org/653843002/diff/100001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm File chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm (right): https://codereview.chromium.org/653843002/diff/100001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm#newcode263 chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm:263: if (extension_id == host->extension_id()) On 2015/02/18 22:38:02, Robert Sesek ...
5 years, 10 months ago (2015-02-18 22:46:04 UTC) #9
Robert Sesek
LGTM
5 years, 10 months ago (2015-02-18 22:48:21 UTC) #10
tapted
https://codereview.chromium.org/653843002/diff/140001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm File chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm (right): https://codereview.chromium.org/653843002/diff/140001/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm#newcode263 chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm:263: DCHECK(!gPopup); tl;dr - I had to remove the DCHECK ...
5 years, 10 months ago (2015-02-19 07:38:17 UTC) #12
tapted
I think this CL is all good to go, but please yell at me if ...
5 years, 10 months ago (2015-02-19 08:14:42 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/653843002/160001
5 years, 10 months ago (2015-02-19 08:15:36 UTC) #15
commit-bot: I haz the power
Committed patchset #8 (id:160001)
5 years, 10 months ago (2015-02-19 08:39:48 UTC) #16
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/836dc7a4b828bffdd351db39cb3738ad36dba332 Cr-Commit-Position: refs/heads/master@{#317011}
5 years, 10 months ago (2015-02-19 08:40:48 UTC) #17
Robert Sesek
5 years, 10 months ago (2015-02-19 16:14:46 UTC) #18
Message was sent while issue was closed.
On 2015/02/19 08:14:42, tapted wrote:
> I think this CL is all good to go, but please yell at me if that's not the
case,
> or there's anything else I should follow-up on. Thanks!

What you wrote sounds fine. Thanks for filing the bugs!

Powered by Google App Engine
This is Rietveld 408576698