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

Unified Diff: chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm

Issue 10917274: Re-enable native UI for {frame:'chrome'} in app windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 8 years, 3 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/extensions/shell_window_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
index 82cb3378718185d15da4ecfd21ee199dfeace9f3..a51806361a3e558bbf08a6e662eaf341a7e7ffbe 100644
--- a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
@@ -86,18 +86,18 @@
@end
-@interface ShellNSWindow : ChromeEventProcessingWindow
-
-- (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view;
-
-@end
-
// This is really a method on NSGrayFrame, so it should only be called on the
// view passed into -[NSWindow drawCustomFrameRect:forView:].
@interface NSView (PrivateMethods)
- (CGFloat)roundedCornerRadius;
@end
+@interface ShellNSWindow : ChromeEventProcessingWindow
+
+- (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view;
+
+@end
+
@implementation ShellNSWindow
- (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view {
@@ -116,6 +116,14 @@
NSRectFill(rect);
}
+@end
+
+@interface ShellFramelessNSWindow : ShellNSWindow
+
+@end
+
+@implementation ShellFramelessNSWindow
+
+ (NSRect)frameRectForContentRect:(NSRect)contentRect
styleMask:(NSUInteger)mask {
return contentRect;
@@ -175,11 +183,20 @@ ShellWindowCocoa::ShellWindowCocoa(ShellWindow* shell_window,
NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSResizableWindowMask |
NSTexturedBackgroundWindowMask;
- scoped_nsobject<NSWindow> window([[ShellNSWindow alloc]
- initWithContentRect:cocoa_bounds
- styleMask:style_mask
- backing:NSBackingStoreBuffered
- defer:NO]);
+ scoped_nsobject<NSWindow> window;
+ if (has_frame_) {
+ window.reset([[ShellNSWindow alloc]
+ initWithContentRect:cocoa_bounds
+ styleMask:style_mask
+ backing:NSBackingStoreBuffered
+ defer:NO]);
+ } else {
+ window.reset([[ShellFramelessNSWindow alloc]
+ initWithContentRect:cocoa_bounds
+ styleMask:style_mask
+ backing:NSBackingStoreBuffered
+ defer:NO]);
+ }
[window setTitle:base::SysUTF8ToNSString(extension()->name())];
gfx::Size min_size = params.minimum_size;
if (min_size.width() || min_size.height()) {
« no previous file with comments | « chrome/browser/extensions/api/app_window/app_window_api.cc ('k') | chrome/browser/ui/extensions/shell_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698