summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 15:23:58 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 15:23:58 +0000
commitdb9a89edef7f262df2091e08a88e015a752a61c9 (patch)
tree8e8842b913b2266eb45bc7abe4075dc9e0dfc800
parentd2359559618e7aad5fb2b98cbd9a06420fe89c5c (diff)
downloadchromium_src-db9a89edef7f262df2091e08a88e015a752a61c9.zip
chromium_src-db9a89edef7f262df2091e08a88e015a752a61c9.tar.gz
chromium_src-db9a89edef7f262df2091e08a88e015a752a61c9.tar.bz2
Pinstripe the top of the browser window to give it that 3D effect.
BUG=http://crbug.com/36794 TEST=as in bug Review URL: http://codereview.chromium.org/660305 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40380 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/cocoa/browser_frame_view.h6
-rw-r--r--chrome/browser/cocoa/browser_frame_view.mm30
2 files changed, 29 insertions, 7 deletions
diff --git a/chrome/browser/cocoa/browser_frame_view.h b/chrome/browser/cocoa/browser_frame_view.h
index 3ae13ea0..ebee82c 100644
--- a/chrome/browser/cocoa/browser_frame_view.h
+++ b/chrome/browser/cocoa/browser_frame_view.h
@@ -50,8 +50,10 @@
// not.
@interface BrowserFrameView : NSView
-// Draws the window theme into the specified rect.
-+ (void)drawWindowThemeInDirtyRect:(NSRect)dirtyRect
+// Draws the window theme into the specified rect. Returns whether a theme was
+// drawn (whether incognito or full pattern theme; an overlay image doesn't
+// count).
++ (BOOL)drawWindowThemeInDirtyRect:(NSRect)dirtyRect
forView:(NSView*)view
bounds:(NSRect)bounds;
diff --git a/chrome/browser/cocoa/browser_frame_view.mm b/chrome/browser/cocoa/browser_frame_view.mm
index bf999c6..38c3501 100644
--- a/chrome/browser/cocoa/browser_frame_view.mm
+++ b/chrome/browser/cocoa/browser_frame_view.mm
@@ -106,17 +106,32 @@
[[NSBezierPath bezierPathWithRect:rect] addClip];
// Do the theming.
- [BrowserFrameView drawWindowThemeInDirtyRect:rect
- forView:self
- bounds:windowRect];
+ BOOL themed = [BrowserFrameView drawWindowThemeInDirtyRect:rect
+ forView:self
+ bounds:windowRect];
+
+ // Pinstripe the top.
+ if (themed) {
+ windowRect = [window frame];
+ windowRect.origin = NSMakePoint(0, 0);
+ windowRect.origin.y -= 0.5;
+ windowRect.origin.x -= 0.5;
+ windowRect.size.width += 1.0;
+ [[NSColor colorWithCalibratedWhite:1.0 alpha:0.5] set];
+ NSBezierPath* path = [NSBezierPath bezierPathWithRoundedRect:windowRect
+ xRadius:4
+ yRadius:4];
+ [path setLineWidth:1.0];
+ [path stroke];
+ }
}
-+ (void)drawWindowThemeInDirtyRect:(NSRect)dirtyRect
++ (BOOL)drawWindowThemeInDirtyRect:(NSRect)dirtyRect
forView:(NSView*)view
bounds:(NSRect)bounds {
ThemeProvider* themeProvider = [[view window] themeProvider];
if (!themeProvider)
- return;
+ return NO;
BOOL active = [[view window] isMainWindow];
BOOL incognito = [[view window] themeIsIncognito];
@@ -142,6 +157,7 @@
active ? BrowserThemeProvider::GRADIENT_FRAME_INCOGNITO :
BrowserThemeProvider::GRADIENT_FRAME_INCOGNITO_INACTIVE);
+ BOOL themed = NO;
if (themeImage) {
NSColor* themeImageColor = [NSColor colorWithPatternImage:themeImage];
@@ -163,6 +179,7 @@
[[NSGraphicsContext currentContext] setPatternPhase:phase];
[themeImageColor set];
NSRectFill(dirtyRect);
+ themed = YES;
} else if (gradient) {
// Only paint the gradient at the top of the window. (This is at the maximum
// when fullscreening; before adjusting check this case.)
@@ -173,6 +190,7 @@
gradientRect.size.height = kBrowserFrameViewGradientHeight;
[gradient drawInRect:gradientRect angle:270];
+ themed = YES;
}
// Check to see if we have an overlay image.
@@ -190,6 +208,8 @@
operation:NSCompositeSourceOver
fraction:1.0];
}
+
+ return themed;
}
// Check to see if the mouse is currently in one of our window widgets.