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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 @interface ShellNSWindow : ChromeEventProcessingWindow | 210 @interface ShellNSWindow : ChromeEventProcessingWindow |
211 @end | 211 @end |
212 @implementation ShellNSWindow | 212 @implementation ShellNSWindow |
213 | 213 |
214 // Similar to ChromeBrowserWindow, don't draw the title, but allow it to be seen | 214 // Similar to ChromeBrowserWindow, don't draw the title, but allow it to be seen |
215 // in menus, Expose, etc. | 215 // in menus, Expose, etc. |
216 - (BOOL)_isTitleHidden { | 216 - (BOOL)_isTitleHidden { |
217 return YES; | 217 return YES; |
218 } | 218 } |
219 | 219 |
220 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view { | |
221 // Make the background color of the content area white. We can't just call | |
222 // -setBackgroundColor as that causes the title bar to be drawn in a solid | |
223 // color. | |
224 NSRect contentRect = [NSWindow contentRectForFrameRect:rect | |
tapted
2014/06/17 06:09:51
I think you can use [self contentRectForFrameRect:
jackhou1
2014/06/17 07:00:14
Done.
| |
225 styleMask:[self styleMask]]; | |
226 [[NSColor whiteColor] set]; | |
227 NSRectFill(contentRect); | |
228 | |
229 // Draw the native title bar. We clip the content area since the native | |
230 // implementation draws a grey background. | |
tapted
2014/06/17 06:09:52
nit: grey -> gray to be consistent with color :p
jackhou1
2014/06/17 07:00:14
Done.
| |
231 NSRect titleBarRect = NSIntersectionRect(rect, | |
232 NSMakeRect(NSMinX(contentRect), | |
tapted
2014/06/17 06:09:51
I stared at the second argument for a while before
jackhou1
2014/06/17 07:00:14
Done.
| |
233 NSMaxY(contentRect), | |
234 NSWidth(contentRect), | |
235 CGFLOAT_MAX)); | |
236 [NSBezierPath clipRect:titleBarRect]; | |
tapted
2014/06/17 06:09:52
It's possible clipping will be more expensive than
| |
237 [super drawCustomFrameRect:rect | |
238 forView:view]; | |
239 } | |
240 | |
220 @end | 241 @end |
221 | 242 |
222 @interface ShellCustomFrameNSWindow : ShellNSWindow { | 243 @interface ShellCustomFrameNSWindow : ShellNSWindow { |
223 @private | 244 @private |
224 base::scoped_nsobject<NSColor> color_; | 245 base::scoped_nsobject<NSColor> color_; |
225 base::scoped_nsobject<NSColor> inactiveColor_; | 246 base::scoped_nsobject<NSColor> inactiveColor_; |
226 } | 247 } |
227 | 248 |
228 - (void)setColor:(NSColor*)color | 249 - (void)setColor:(NSColor*)color |
229 inactiveColor:(NSColor*)inactiveColor; | 250 inactiveColor:(NSColor*)inactiveColor; |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
963 } | 984 } |
964 | 985 |
965 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 986 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
966 if (IsRestored(*this)) | 987 if (IsRestored(*this)) |
967 restored_bounds_ = [window() frame]; | 988 restored_bounds_ = [window() frame]; |
968 } | 989 } |
969 | 990 |
970 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { | 991 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { |
971 [window() orderOut:window_controller_]; | 992 [window() orderOut:window_controller_]; |
972 } | 993 } |
OLD | NEW |