diff options
Diffstat (limited to 'chrome/browser/cocoa/floating_bar_backing_view.mm')
-rw-r--r-- | chrome/browser/cocoa/floating_bar_backing_view.mm | 56 |
1 files changed, 5 insertions, 51 deletions
diff --git a/chrome/browser/cocoa/floating_bar_backing_view.mm b/chrome/browser/cocoa/floating_bar_backing_view.mm index 6289099..3864d76 100644 --- a/chrome/browser/cocoa/floating_bar_backing_view.mm +++ b/chrome/browser/cocoa/floating_bar_backing_view.mm @@ -3,7 +3,8 @@ // found in the LICENSE file. #include "chrome/browser/cocoa/floating_bar_backing_view.h" -#import "chrome/browser/cocoa/GTMTheme.h" + +#import "chrome/browser/cocoa/browser_frame_view.h" @implementation FloatingBarBackingView @@ -17,56 +18,9 @@ [[NSColor windowBackgroundColor] set]; NSRectFill(rect); - // The code here mirrors the code in browser_frame_view.mm, with modifications - // to not use window rect and not draw rounded corners. - NSRect bounds = [self bounds]; - - // Draw our background image or theme pattern, if one exists. - GTMTheme* theme = [self gtm_theme]; - GTMThemeState state = isMainWindow ? GTMThemeStateActiveWindow - : GTMThemeStateInactiveWindow; - NSColor* color = [theme backgroundPatternColorForStyle:GTMThemeStyleWindow - state:state]; - if (color) { - // The titlebar/tabstrip header on the mac is slightly smaller than on - // Windows. To keep the window background lined up with the tab and toolbar - // patterns, we have to shift the pattern slightly, rather than simply - // drawing it from the top left corner. The offset below was empirically - // determined in order to line these patterns up. - // - // This will make the themes look slightly different than in Windows/Linux - // because of the differing heights between window top and tab top, but this - // has been approved by UI. - static const NSPoint kBrowserFrameViewPatternPhaseOffset = { -5, 2 }; - NSPoint offsetTopLeft = kBrowserFrameViewPatternPhaseOffset; - offsetTopLeft.y += NSHeight(bounds); - - // We want the pattern to start at the upper left corner of the floating - // bar, but the phase needs to be in the coordinate system of - // |windowChromeView|. - NSView* windowChromeView = [[[self window] contentView] superview]; - NSPoint phase = [self convertPoint:offsetTopLeft toView:windowChromeView]; - - // Apply the offset. - [[NSGraphicsContext currentContext] setPatternPhase:phase]; - [color set]; - NSRectFill(rect); - } - - // Check to see if we have an overlay image. - NSImage* overlayImage = [theme valueForAttribute:@"overlay" - style:GTMThemeStyleWindow - state:state]; - if (overlayImage) { - // Anchor to top-left and don't scale. - NSSize overlaySize = [overlayImage size]; - NSRect imageFrame = NSMakeRect(0, 0, overlaySize.width, overlaySize.height); - [overlayImage drawAtPoint:NSMakePoint(0, NSHeight(bounds) - - overlaySize.height) - fromRect:imageFrame - operation:NSCompositeSourceOver - fraction:1.0]; - } + [BrowserFrameView drawWindowThemeInDirtyRect:rect + forView:self + bounds:[self bounds]]; } // Eat all mouse events (and do *not* pass them on to the next responder!). |