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

Unified Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm

Issue 10870094: Constrained window sheet controller (test patch) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename Created 8 years, 4 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/constrained_window/constrained_window_custom_window.mm
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm
new file mode 100644
index 0000000000000000000000000000000000000000..62f61e9276793fc3f3ffad3c5c2dcddb55d91afc
--- /dev/null
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm
@@ -0,0 +1,50 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h"
+
+#import "base/memory/scoped_nsobject.h"
+#import "chrome/browser/ui/constrained_window.h"
+#include "skia/ext/skia_utils_mac.h"
+
+// The content view for the custom window.
+@interface ConstrainedWindowCustomWindowContentView : NSView
+@end
+
+@implementation ConstrainedWindowCustomWindow
+
+- (id)initWithContentRect:(NSRect)contentRect {
+ if ((self = [super initWithContentRect:contentRect
+ styleMask:NSBorderlessWindowMask
+ backing:NSBackingStoreBuffered
+ defer:NO])) {
+ [self setHasShadow:YES];
+ [self setBackgroundColor:[NSColor clearColor]];
+ [self setOpaque:NO];
+ scoped_nsobject<NSView> content_view(
+ [[ConstrainedWindowCustomWindowContentView alloc]
+ initWithFrame:NSZeroRect]);
+ [self setContentView:content_view];
+ }
+ return self;
+}
+
+- (BOOL)canBecomeKeyWindow {
+ return YES;
+}
+
+@end
+
+@implementation ConstrainedWindowCustomWindowContentView
+
+- (void)drawRect:(NSRect)rect {
+ NSBezierPath* path = [NSBezierPath
+ bezierPathWithRoundedRect:[self bounds]
+ xRadius:ConstrainedWindow::kBorderRadius
+ yRadius:ConstrainedWindow::kBorderRadius];
+ [gfx::SkColorToCalibratedNSColor(ConstrainedWindow::kBackgroundColor) set];
+ [path fill];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698