OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" |
6 | 6 |
7 #include "apps/app_shim/extension_app_shim_handler_mac.h" | 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // Similar to ChromeBrowserWindow, don't draw the title, but allow it to be seen | 229 // Similar to ChromeBrowserWindow, don't draw the title, but allow it to be seen |
230 // in menus, Expose, etc. | 230 // in menus, Expose, etc. |
231 - (BOOL)_isTitleHidden { | 231 - (BOOL)_isTitleHidden { |
232 // Only intervene with 10.6-10.9. | 232 // Only intervene with 10.6-10.9. |
233 if ([self respondsToSelector:@selector(setTitleVisibility:)]) | 233 if ([self respondsToSelector:@selector(setTitleVisibility:)]) |
234 return [super _isTitleHidden]; | 234 return [super _isTitleHidden]; |
235 else | 235 else |
236 return YES; | 236 return YES; |
237 } | 237 } |
238 | 238 |
| 239 - (void)drawCustomFrameRect:(NSRect)frameRect forView:(NSView*)view { |
| 240 // Make the background color of the content area white. We can't just call |
| 241 // -setBackgroundColor as that causes the title bar to be drawn in a solid |
| 242 // color. |
| 243 NSRect rect = [self contentRectForFrameRect:frameRect]; |
| 244 [[NSColor whiteColor] set]; |
| 245 NSRectFill(rect); |
| 246 |
| 247 // Draw the native title bar. We remove the content area since the native |
| 248 // implementation draws a gray background. |
| 249 rect.origin.y = NSMaxY(rect); |
| 250 rect.size.height = CGFLOAT_MAX; |
| 251 rect = NSIntersectionRect(rect, frameRect); |
| 252 |
| 253 [NSBezierPath clipRect:rect]; |
| 254 [super drawCustomFrameRect:frameRect |
| 255 forView:view]; |
| 256 } |
| 257 |
239 @end | 258 @end |
240 | 259 |
241 @interface ShellCustomFrameNSWindow : ShellNSWindow { | 260 @interface ShellCustomFrameNSWindow : ShellNSWindow { |
242 @private | 261 @private |
243 base::scoped_nsobject<NSColor> color_; | 262 base::scoped_nsobject<NSColor> color_; |
244 base::scoped_nsobject<NSColor> inactiveColor_; | 263 base::scoped_nsobject<NSColor> inactiveColor_; |
245 } | 264 } |
246 | 265 |
247 - (void)setColor:(NSColor*)color | 266 - (void)setColor:(NSColor*)color |
248 inactiveColor:(NSColor*)inactiveColor; | 267 inactiveColor:(NSColor*)inactiveColor; |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 } | 1001 } |
983 | 1002 |
984 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 1003 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
985 if (IsRestored(*this)) | 1004 if (IsRestored(*this)) |
986 restored_bounds_ = [window() frame]; | 1005 restored_bounds_ = [window() frame]; |
987 } | 1006 } |
988 | 1007 |
989 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { | 1008 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { |
990 [window() orderOut:window_controller_]; | 1009 [window() orderOut:window_controller_]; |
991 } | 1010 } |
OLD | NEW |