Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm

Issue 307843002: Always set NSTexturedBackgroundWindowMask on app windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 @end 216 @end
217 217
218 // TODO(jamescook): Should these be AppNSWindow to match apps::AppWindow? 218 // TODO(jamescook): Should these be AppNSWindow to match apps::AppWindow?
219 // http://crbug.com/344082 219 // http://crbug.com/344082
220 @interface ShellNSWindow : ChromeEventProcessingWindow 220 @interface ShellNSWindow : ChromeEventProcessingWindow
221 @end 221 @end
222 @implementation ShellNSWindow 222 @implementation ShellNSWindow
223 @end 223 @end
224 224
225 @interface ShellCustomFrameNSWindow : ShellNSWindow 225 @interface ShellCustomFrameNSWindow : ShellNSWindow
226
227 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view; 226 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view;
228
229 @end 227 @end
230 228
231 @implementation ShellCustomFrameNSWindow 229 @implementation ShellCustomFrameNSWindow
232 230
233 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view { 231 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view {
234 [[NSBezierPath bezierPathWithRect:rect] addClip]; 232 [[NSBezierPath bezierPathWithRect:rect] addClip];
235 [[NSColor clearColor] set]; 233 [[NSColor clearColor] set];
236 NSRectFill(rect); 234 NSRectFill(rect);
237 235
238 // Set up our clip. 236 // Set up our clip.
239 CGFloat cornerRadius = 4.0; 237 CGFloat cornerRadius = 4.0;
240 if ([view respondsToSelector:@selector(roundedCornerRadius)]) 238 if ([view respondsToSelector:@selector(roundedCornerRadius)])
241 cornerRadius = [view roundedCornerRadius]; 239 cornerRadius = [view roundedCornerRadius];
242 [[NSBezierPath bezierPathWithRoundedRect:[view bounds] 240 [[NSBezierPath bezierPathWithRoundedRect:[view bounds]
243 xRadius:cornerRadius 241 xRadius:cornerRadius
244 yRadius:cornerRadius] addClip]; 242 yRadius:cornerRadius] addClip];
245 [[NSColor whiteColor] set]; 243 [[NSColor whiteColor] set];
246 NSRectFill(rect); 244 NSRectFill(rect);
247 } 245 }
248 246
249 @end 247 @end
250 248
251 @interface ShellFramelessNSWindow : ShellCustomFrameNSWindow 249 @interface ShellFramelessNSWindow : ShellNSWindow
252 250 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view;
tapted 2014/05/29 03:35:28 I'd move this up into the ShellNSWindow interface
jackhou1 2014/05/29 04:09:40 ShellNSWindow is used to draw native frames, so it
253 @end 251 @end
254 252
255 @implementation ShellFramelessNSWindow 253 @implementation ShellFramelessNSWindow
256 254
255 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view {}
256
257 + (NSRect)frameRectForContentRect:(NSRect)contentRect 257 + (NSRect)frameRectForContentRect:(NSRect)contentRect
258 styleMask:(NSUInteger)mask { 258 styleMask:(NSUInteger)mask {
259 return contentRect; 259 return contentRect;
260 } 260 }
261 261
262 + (NSRect)contentRectForFrameRect:(NSRect)frameRect 262 + (NSRect)contentRectForFrameRect:(NSRect)frameRect
263 styleMask:(NSUInteger)mask { 263 styleMask:(NSUInteger)mask {
264 return frameRect; 264 return frameRect;
265 } 265 }
266 266
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 366
367 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryCocoa( 367 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryCocoa(
368 Profile::FromBrowserContext(app_window_->browser_context()), 368 Profile::FromBrowserContext(app_window_->browser_context()),
369 window, 369 window,
370 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, 370 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
371 NULL)); 371 NULL));
372 } 372 }
373 373
374 NSUInteger NativeAppWindowCocoa::GetWindowStyleMask() const { 374 NSUInteger NativeAppWindowCocoa::GetWindowStyleMask() const {
375 NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | 375 NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask |
376 NSMiniaturizableWindowMask; 376 NSMiniaturizableWindowMask |
377 NSTexturedBackgroundWindowMask;
tapted 2014/05/29 03:35:28 The documentation suggests that adding this has a
jackhou1 2014/05/29 04:09:40 Yeah, and I think this only applies for native fra
377 if (shows_resize_controls_) 378 if (shows_resize_controls_)
378 style_mask |= NSResizableWindowMask; 379 style_mask |= NSResizableWindowMask;
379 if (!has_frame_ ||
380 !CommandLine::ForCurrentProcess()->HasSwitch(
381 switches::kAppsUseNativeFrame)) {
382 style_mask |= NSTexturedBackgroundWindowMask;
383 }
384 return style_mask; 380 return style_mask;
385 } 381 }
386 382
387 void NativeAppWindowCocoa::InstallView() { 383 void NativeAppWindowCocoa::InstallView() {
388 NSView* view = WebContents()->GetNativeView(); 384 NSView* view = WebContents()->GetNativeView();
389 if (has_frame_) { 385 if (has_frame_) {
390 [view setFrame:[[window() contentView] bounds]]; 386 [view setFrame:[[window() contentView] bounds]];
391 [[window() contentView] addSubview:view]; 387 [[window() contentView] addSubview:view];
392 if (!shows_fullscreen_controls_) 388 if (!shows_fullscreen_controls_)
393 [[window() standardWindowButton:NSWindowZoomButton] setEnabled:NO]; 389 [[window() standardWindowButton:NSWindowZoomButton] setEnabled:NO];
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 } 948 }
953 949
954 void NativeAppWindowCocoa::UpdateRestoredBounds() { 950 void NativeAppWindowCocoa::UpdateRestoredBounds() {
955 if (IsRestored(*this)) 951 if (IsRestored(*this))
956 restored_bounds_ = [window() frame]; 952 restored_bounds_ = [window() frame];
957 } 953 }
958 954
959 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { 955 void NativeAppWindowCocoa::HideWithoutMarkingHidden() {
960 [window() orderOut:window_controller_]; 956 [window() orderOut:window_controller_];
961 } 957 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698