Chromium Code Reviews| 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 [super drawCustomFrameRect:rect | |
| 222 forView:view]; | |
| 223 | |
| 224 // Make the background color of the content area white. | |
| 225 NSRect contentRect = [NSWindow contentRectForFrameRect:rect | |
| 226 styleMask:[self styleMask]]; | |
| 227 [[NSBezierPath bezierPathWithRect:contentRect] addClip]; | |
| 228 [[NSColor whiteColor] set]; | |
| 229 NSRectFill(rect); | |
| 230 } | |
| 231 | |
| 220 @end | 232 @end |
| 221 | 233 |
| 222 @interface ShellCustomFrameNSWindow : ShellNSWindow { | 234 @interface ShellCustomFrameNSWindow : ShellNSWindow { |
| 223 @private | 235 @private |
| 224 base::scoped_nsobject<NSColor> color_; | 236 base::scoped_nsobject<NSColor> color_; |
| 225 base::scoped_nsobject<NSColor> inactiveColor_; | 237 base::scoped_nsobject<NSColor> inactiveColor_; |
| 226 } | 238 } |
| 227 | 239 |
| 228 - (void)setColor:(NSColor*)color | 240 - (void)setColor:(NSColor*)color |
| 229 inactiveColor:(NSColor*)inactiveColor; | 241 inactiveColor:(NSColor*)inactiveColor; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 | 345 |
| 334 // Estimate the initial bounds of the window. Once the frame insets are known, | 346 // Estimate the initial bounds of the window. Once the frame insets are known, |
| 335 // the window bounds and constraints can be set precisely. | 347 // the window bounds and constraints can be set precisely. |
| 336 NSRect cocoa_bounds = GfxToCocoaBounds( | 348 NSRect cocoa_bounds = GfxToCocoaBounds( |
| 337 params.GetInitialWindowBounds(gfx::Insets())); | 349 params.GetInitialWindowBounds(gfx::Insets())); |
| 338 window.reset([[window_class alloc] | 350 window.reset([[window_class alloc] |
| 339 initWithContentRect:cocoa_bounds | 351 initWithContentRect:cocoa_bounds |
| 340 styleMask:GetWindowStyleMask() | 352 styleMask:GetWindowStyleMask() |
| 341 backing:NSBackingStoreBuffered | 353 backing:NSBackingStoreBuffered |
| 342 defer:NO]); | 354 defer:NO]); |
| 343 | 355 |
|
tapted
2014/06/17 00:21:53
would it make sense to just call [window setBackgr
jackhou1
2014/06/17 00:37:15
That seems to make the entire background white (in
tapted
2014/06/17 06:09:51
Ah - yeah that would suck.
| |
| 344 std::string name; | 356 std::string name; |
| 345 const extensions::Extension* extension = app_window_->GetExtension(); | 357 const extensions::Extension* extension = app_window_->GetExtension(); |
| 346 if (extension) | 358 if (extension) |
| 347 name = extension->name(); | 359 name = extension->name(); |
| 348 [window setTitle:base::SysUTF8ToNSString(name)]; | 360 [window setTitle:base::SysUTF8ToNSString(name)]; |
| 349 [[window contentView] cr_setWantsLayer:YES]; | 361 [[window contentView] cr_setWantsLayer:YES]; |
| 350 if (has_frame_ && has_frame_color_) { | 362 if (has_frame_ && has_frame_color_) { |
| 351 [base::mac::ObjCCastStrict<ShellCustomFrameNSWindow>(window) | 363 [base::mac::ObjCCastStrict<ShellCustomFrameNSWindow>(window) |
| 352 setColor:gfx::SkColorToSRGBNSColor(active_frame_color_) | 364 setColor:gfx::SkColorToSRGBNSColor(active_frame_color_) |
| 353 inactiveColor:gfx::SkColorToSRGBNSColor(inactive_frame_color_)]; | 365 inactiveColor:gfx::SkColorToSRGBNSColor(inactive_frame_color_)]; |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 963 } | 975 } |
| 964 | 976 |
| 965 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 977 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
| 966 if (IsRestored(*this)) | 978 if (IsRestored(*this)) |
| 967 restored_bounds_ = [window() frame]; | 979 restored_bounds_ = [window() frame]; |
| 968 } | 980 } |
| 969 | 981 |
| 970 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { | 982 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { |
| 971 [window() orderOut:window_controller_]; | 983 [window() orderOut:window_controller_]; |
| 972 } | 984 } |
| OLD | NEW |