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

Unified Diff: chrome/browser/ui/cocoa/version_independent_window.h

Issue 646703002: mac: Use a full-size content view (reland 1). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from avi. Created 6 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/version_independent_window.h
diff --git a/chrome/browser/ui/cocoa/version_independent_window.h b/chrome/browser/ui/cocoa/version_independent_window.h
index 24acce17741f75d1f7d763cb4001797dbe09ffb8..afa4e486a5c0d4d437c8faeea774bdc21a7126cf 100644
--- a/chrome/browser/ui/cocoa/version_independent_window.h
+++ b/chrome/browser/ui/cocoa/version_independent_window.h
@@ -19,35 +19,25 @@
@end
-// In OSX 10.10, adding subviews to the root view for the NSView hierarchy
-// produces warnings. To eliminate the warnings, we resize the contentView to
-// fill the window, and add subviews to that. When this class is used on OSX
-// 10.9 and lower, subviews are added directly to the root view, and the
-// contentView is not resized.
-// http://crbug.com/380412
+// By default, the contentView does not occupy the full size of a framed
+// window. Chrome still wants to draw in the title bar. Historically, Chrome
+// has done this by adding subviews directly to the root view. This causes
+// several problems. The most egregious is related to layer ordering when the
+// root view does not have a layer. By giving the contentView the same size as
+// the window, there is no longer any need to add subviews to the root view.
//
-// For code to be 10.9 and 10.10 compatible, views should be added to [window
-// cr_windowView] instead of [[window contentView] superview].
+// No views should be manually added to [[window contentView] superview].
+// Instead, they should be added to [window cr_windowView].
//
// If the window does not have a titlebar, then its contentView already has the
// same size as the window. In this case, this class has no effect.
//
// This class currently does not support changing the window's style after the
// window has been initialized.
-//
-// Since the contentView's size varies between OSes, several NSWindow methods
-// are no longer well defined.
-// - setContentSize:
-// - setContentMinSize:
-// - setContentMaxSize:
-// - setContentAspectRatio:
-// The implementation of this class on OSX 10.10 uses a hacked subclass of
-// NSView. It currently does not support the above 4 methods.
@interface VersionIndependentWindow : ChromeEventProcessingWindow {
@private
- // Holds the view that replaces [window contentView]. This view's size is the
- // same as the window's size.
- // Empty on 10.9 and lower, or if there is no titlebar.
+ // Holds the view that replaces [window contentView]. This view has the same
+ // size as the window. Empty if there is no titlebar.
base::scoped_nsobject<NSView> chromeWindowView_;
}
@@ -55,7 +45,8 @@
- (instancetype)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)windowStyle
backing:(NSBackingStoreType)bufferingType
- defer:(BOOL)deferCreation;
+ defer:(BOOL)deferCreation
+ wantsViewsOverTitlebar:(BOOL)wantsViewsOverTitlebar;
@end
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_window_controller.mm ('k') | chrome/browser/ui/cocoa/version_independent_window.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698