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

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

Issue 7890056: FullscreenExitBubble temp UI for Mac. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 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/fullscreen_exit_bubble_view.mm
diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.mm b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.mm
new file mode 100644
index 0000000000000000000000000000000000000000..9fbbce606918981e321bbd196835a5104590f3ae
--- /dev/null
+++ b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.mm
@@ -0,0 +1,138 @@
+// Copyright (c) 2011 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/fullscreen_exit_bubble_view.h"
+
+#import "chrome/browser/ui/cocoa/nsview_additions.h"
+#import "chrome/browser/ui/cocoa/themed_window.h"
+#import "chrome/browser/ui/cocoa/url_drop_target.h"
+#import "chrome/browser/ui/cocoa/view_id_util.h"
+#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
+
+namespace {
+CGFloat kCurveSize = 8;
+} // end namespace
+
+@implementation FullscreenExitBubbleView
+
+- (void)awakeFromNib {
+}
+
+- (void)drawRect:(NSRect)rect {
+ const CGFloat lineWidth = [self cr_lineWidth];
+ const CGFloat halfLineWidth = lineWidth / 2.0;
+
+ // TODO(rohitrao): Make this prettier.
+ rect = NSInsetRect([self bounds], halfLineWidth, halfLineWidth);
+ rect = NSOffsetRect(rect, 0, lineWidth);
+
+ // TODO: i just haxed these to make it draw right.
+ NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect));
+ NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect));
+ NSPoint midLeft1 =
+ NSMakePoint(NSMinX(rect), NSMaxY(rect) - kCurveSize);
+ NSPoint midLeft2 =
+ NSMakePoint(NSMinX(rect), NSMinY(rect) + kCurveSize);
+ NSPoint midRight1 =
+ NSMakePoint(NSMaxX(rect), NSMinY(rect) + kCurveSize);
+ NSPoint midRight2 =
+ NSMakePoint(NSMaxX(rect), NSMaxY(rect) - kCurveSize);
+ NSPoint bottomLeft =
+ NSMakePoint(NSMinX(rect) + (1 * kCurveSize), NSMinY(rect));
+ NSPoint bottomRight =
+ NSMakePoint(NSMaxX(rect) - (1 * kCurveSize), NSMinY(rect));
+
+ NSBezierPath* path = [NSBezierPath bezierPath];
+ [path moveToPoint:topLeft];
+ [path curveToPoint:midLeft1
+ controlPoint1:NSMakePoint(midLeft1.x, topLeft.y)
+ controlPoint2:NSMakePoint(midLeft1.x, topLeft.y)];
+ [path lineToPoint:midLeft2];
+ [path curveToPoint:bottomLeft
+ controlPoint1:NSMakePoint(midLeft2.x, bottomLeft.y)
+ controlPoint2:NSMakePoint(midLeft2.x, bottomLeft.y)];
+
+ [path lineToPoint:bottomRight];
+ [path curveToPoint:midRight1
+ controlPoint1:NSMakePoint(midRight1.x, bottomLeft.y)
+ controlPoint2:NSMakePoint(midRight1.x, bottomLeft.y)];
+ [path lineToPoint:midRight2];
+ [path curveToPoint:topRight
+ controlPoint1:NSMakePoint(midRight2.x, topLeft.y)
+ controlPoint2:NSMakePoint(midRight2.x, topLeft.y)];
+
+ {
+ gfx::ScopedNSGraphicsContextSaveGState scopedGState;
+ //NSGraphicsContext* context = [NSGraphicsContext currentContext];
+ [path addClip];
+
+ const NSRect bounds = [self bounds];
+
+ [[NSColor colorWithDeviceWhite:0 alpha:0.8] set];
+ NSRectFillUsingOperation(bounds, NSCompositeSourceOver);
+ }
+
+ //[[self strokeColor] set];
+ //[path setLineWidth:lineWidth];
+ //[path stroke];
+}
+
+// The findbar is mostly opaque, but has an 8px transparent border on the left
+// and right sides (see |kCurveSize|). This is an artifact of the way it is
+// drawn. We override hitTest to return nil for points in this transparent
+// area.
+/*- (NSView*)hitTest:(NSPoint)point {
+ NSView* hitView = [super hitTest:point];
+ if (hitView == self) {
+ // |rect| is approximately equivalent to the opaque area of the findbar.
+ NSRect rect = NSInsetRect([self bounds], kCurveSize, 0);
+ if (!NSMouseInRect(point, rect, [self isFlipped]))
+ return nil;
+ }
+
+ return hitView;
+}*/
+
+// Eat all mouse events, to prevent clicks from falling through to views below.
+- (void)mouseDown:(NSEvent *)theEvent {
+}
+
+- (void)rightMouseDown:(NSEvent *)theEvent {
+}
+
+- (void)otherMouseDown:(NSEvent *)theEvent {
+}
+
+- (void)mouseUp:(NSEvent *)theEvent {
+}
+
+- (void)rightMouseUp:(NSEvent *)theEvent {
+}
+
+- (void)otherMouseUp:(NSEvent *)theEvent {
+}
+
+- (void)mouseMoved:(NSEvent *)theEvent {
+}
+
+- (void)mouseDragged:(NSEvent *)theEvent {
+}
+
+- (void)rightMouseDragged:(NSEvent *)theEvent {
+}
+
+- (void)otherMouseDragged:(NSEvent *)theEvent {
+}
+
+- (ViewID)viewID {
+ return VIEW_ID_FIND_IN_PAGE;
+}
+
+// Specifies that mouse events over this view should be ignored by the
+// render host.
+- (BOOL)nonWebContentView {
+ return YES;
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698