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

Unified Diff: chrome/browser/ui/cocoa/full_size_content_window.mm

Issue 2404783002: [Mac] Avoid "adding unknown subview" warning. (Closed)
Patch Set: Merged with head Created 4 years, 2 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
Index: chrome/browser/ui/cocoa/full_size_content_window.mm
diff --git a/chrome/browser/ui/cocoa/full_size_content_window.mm b/chrome/browser/ui/cocoa/full_size_content_window.mm
index eddf7f4da1d0e43fc21445e9e28ce0015f547f29..3b4c82b2e1e22f2dedc6816bb12a8f3748825098 100644
--- a/chrome/browser/ui/cocoa/full_size_content_window.mm
+++ b/chrome/browser/ui/cocoa/full_size_content_window.mm
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_objc_class_swizzler.h"
+#import "chrome/browser/ui/cocoa/browser_window_layout.h"
@interface FullSizeContentWindow ()
@@ -139,20 +140,23 @@ static IMP g_original_callstacksymbols_implementation;
[self setContentView:chromeWindowView_];
[chromeWindowView_ setFrame:[[chromeWindowView_ superview] bounds]];
- // Our content view overlaps the window control buttons, so we must ensure
- // it is positioned below the buttons.
- NSView* superview = [chromeWindowView_ superview];
- [chromeWindowView_ removeFromSuperview];
-
- // Prevent the AppKit from generating a backtrace to include in it's
- // complaint about our upcoming call to addSubview:positioned:relativeTo:.
- // See +load for more info.
- base::AutoReset<bool> disable_symbolication(&g_disable_callstacksymbols,
- true);
-
- [superview addSubview:chromeWindowView_
- positioned:NSWindowBelow
- relativeTo:nil];
+ if (!chrome::ShouldUseFullSizeContentView()) {
+ // Chrome content view overlaps the window control buttons. Adding
+ // subview above the window's content view ensures that content view is
+ // positioned below the buttons.
+ NSView* superview = [chromeWindowView_ superview];
+ [chromeWindowView_ removeFromSuperview];
+
+ // Prevent the AppKit from generating a backtrace to include in it's
+ // complaint about our upcoming call to
+ // addSubview:positioned:relativeTo:. See +load for more info.
+ base::AutoReset<bool> disable_symbolication(&g_disable_callstacksymbols,
+ true);
+
+ [superview addSubview:chromeWindowView_
+ positioned:NSWindowBelow
+ relativeTo:nil];
+ }
}
}
return self;

Powered by Google App Engine
This is Rietveld 408576698