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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 1733173002: Mac: Make calling WebContents::WasShown/WasHidden the responsibility of the content layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/chrome_tests_unit.gypi » ('j') | chrome/test/BUILD.gn » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index 67f12778ef6851089ab58eb2ee7a5c069c756445..201d05f226b811b5f492e8b396e589efef7b2c72 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -679,7 +679,10 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) {
// ensureContentsVisible (see below) sets content size and autoresizing
// properties.
[newView setFrame:[oldView frame]];
- [switchView_ replaceSubview:oldView with:newView];
+ // Remove the old view first, to ensure ConstrainedWindowSheets keyed to the
+ // old WebContents are removed before adding new ones.
Avi (use Gerrit) 2016/02/29 17:27:23 As a side note, this sounds like a limitation of t
+ [oldView removeFromSuperview];
+ [switchView_ addSubview:newView];
} else {
[newView setFrame:[switchView_ bounds]];
[switchView_ addSubview:newView];
@@ -1376,7 +1379,6 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) {
TabContentsController* oldController =
[tabContentsArray_ objectAtIndex:oldIndex];
[oldController willBecomeUnselectedTab];
- oldContents->WasHidden();
}
}
@@ -1402,10 +1404,8 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) {
// Swap in the contents for the new tab.
[self swapInTabAtIndex:modelIndex];
- if (newContents) {
- newContents->WasShown();
+ if (newContents)
newContents->RestoreFocus();
- }
}
- (void)tabSelectionChanged {
« no previous file with comments | « no previous file | chrome/chrome_tests_unit.gypi » ('j') | chrome/test/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698