| Index: chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
|
| diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
|
| index 6744a8c5f72f47755778e020293f83aaa21bcf0c..39de94aa43479fc104b8cd355510f2713dfbbf49 100644
|
| --- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
|
| +++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
|
| @@ -199,45 +199,6 @@ std::vector<gfx::Rect> CalculateNonDraggableRegions(
|
|
|
| @end
|
|
|
| -// A view that paints a solid color. Used to change the title bar background.
|
| -@interface TitlebarBackgroundView : NSView {
|
| - @private
|
| - base::scoped_nsobject<NSColor> color_;
|
| - base::scoped_nsobject<NSColor> inactiveColor_;
|
| -}
|
| -- (void)setColor:(NSColor*)color
|
| - inactiveColor:(NSColor*)inactiveColor;
|
| -@end
|
| -
|
| -@implementation TitlebarBackgroundView
|
| -
|
| -- (void)drawRect:(NSRect)rect {
|
| - // Only the top corners are rounded. For simplicity, round all 4 corners but
|
| - // draw the bottom corners outside of the visible bounds.
|
| - CGFloat cornerRadius = 4.0;
|
| - NSRect roundedRect = [self bounds];
|
| - roundedRect.origin.y -= cornerRadius;
|
| - roundedRect.size.height += cornerRadius;
|
| - [[NSBezierPath bezierPathWithRoundedRect:roundedRect
|
| - xRadius:cornerRadius
|
| - yRadius:cornerRadius] addClip];
|
| - if ([[self window] isMainWindow] || [[self window] isKeyWindow])
|
| - [color_ set];
|
| - else
|
| - [inactiveColor_ set];
|
| - NSRectFill(rect);
|
| -}
|
| -
|
| -- (void)setColor:(NSColor*)color
|
| - inactiveColor:(NSColor*)inactiveColor {
|
| - color_.reset([color retain]);
|
| - inactiveColor_.reset([inactiveColor retain]);
|
| -}
|
| -
|
| -@end
|
| -
|
| -// TODO(jamescook): Should these be AppNSWindow to match AppWindow?
|
| -// http://crbug.com/344082
|
| @interface AppNSWindow : ChromeEventProcessingWindow
|
| @end
|
|
|
| @@ -332,25 +293,8 @@ NativeAppWindowCocoa::NativeAppWindowCocoa(
|
| [window setTitle:base::SysUTF8ToNSString(name)];
|
| [[window contentView] setWantsLayer:YES];
|
| if (has_frame_ && has_frame_color_) {
|
| - // AppKit only officially supports adding subviews to the window's
|
| - // contentView and not its superview (an NSNextStepFrame). The 10.10 SDK
|
| - // allows adding an NSTitlebarAccessoryViewController to a window, but the
|
| - // view can only be placed above the window control buttons, so we'd have to
|
| - // replicate those.
|
| - NSView* window_view = [[window contentView] superview];
|
| - CGFloat height = NSHeight([window_view bounds]) -
|
| - NSHeight([[window contentView] bounds]);
|
| - titlebar_background_view_.reset([[TitlebarBackgroundView alloc]
|
| - initWithFrame:NSMakeRect(0, NSMaxY([window_view bounds]) - height,
|
| - NSWidth([window_view bounds]), height)]);
|
| - [titlebar_background_view_
|
| - setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
|
| - [window_view addSubview:titlebar_background_view_
|
| - positioned:NSWindowBelow
|
| - relativeTo:nil];
|
| - [titlebar_background_view_
|
| - setColor:gfx::SkColorToSRGBNSColor(active_frame_color_)
|
| - inactiveColor:gfx::SkColorToSRGBNSColor(inactive_frame_color_)];
|
| + gfx::AddColoredTitlebarToNSWindow(window, active_frame_color_,
|
| + inactive_frame_color_);
|
| }
|
|
|
| if (base::mac::IsOSSnowLeopard() &&
|
| @@ -793,7 +737,6 @@ void NativeAppWindowCocoa::WindowWillClose() {
|
| }
|
|
|
| void NativeAppWindowCocoa::WindowDidBecomeKey() {
|
| - [titlebar_background_view_ setNeedsDisplay:YES];
|
| content::RenderWidgetHostView* rwhv =
|
| WebContents()->GetRenderWidgetHostView();
|
| if (rwhv)
|
| @@ -811,8 +754,6 @@ void NativeAppWindowCocoa::WindowDidResignKey() {
|
| if ([NSApp isActive] && ([NSApp keyWindow] == window()))
|
| return;
|
|
|
| - [titlebar_background_view_ setNeedsDisplay:YES];
|
| -
|
| WebContents()->StoreFocus();
|
|
|
| content::RenderWidgetHostView* rwhv =
|
|
|