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

Side by Side Diff: ui/views/widget/native_widget_mac.mm

Issue 1291763005: [MacViews] Use NSTitledWindowMask for window modal dialogs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment. Created 5 years, 4 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 | « no previous file | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/widget/native_widget_mac.h" 5 #include "ui/views/widget/native_widget_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 + (void)closeWindowWithAnimation:(NSWindow*)window; 33 + (void)closeWindowWithAnimation:(NSWindow*)window;
34 34
35 @end 35 @end
36 36
37 namespace views { 37 namespace views {
38 namespace { 38 namespace {
39 39
40 NSInteger StyleMaskForParams(const Widget::InitParams& params) { 40 NSInteger StyleMaskForParams(const Widget::InitParams& params) {
41 // If the Widget is modal, it will be displayed as a sheet. This works best if
42 // it has NSTitledWindowMask. For example, with NSBorderlessWindowMask, the
43 // parent window still accepts input.
44 if (params.delegate &&
45 params.delegate->GetModalType() == ui::MODAL_TYPE_WINDOW)
46 return NSTitledWindowMask;
47
41 // TODO(tapted): Determine better masks when there are use cases for it. 48 // TODO(tapted): Determine better masks when there are use cases for it.
42 if (params.remove_standard_frame) 49 if (params.remove_standard_frame)
43 return NSBorderlessWindowMask; 50 return NSBorderlessWindowMask;
44 51
45 if (params.type == Widget::InitParams::TYPE_WINDOW) { 52 if (params.type == Widget::InitParams::TYPE_WINDOW) {
46 return NSTitledWindowMask | NSClosableWindowMask | 53 return NSTitledWindowMask | NSClosableWindowMask |
47 NSMiniaturizableWindowMask | NSResizableWindowMask | 54 NSMiniaturizableWindowMask | NSResizableWindowMask |
48 NSTexturedBackgroundWindowMask; 55 NSTexturedBackgroundWindowMask;
49 } 56 }
50 return NSBorderlessWindowMask; 57 return NSBorderlessWindowMask;
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; 707 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window];
701 } 708 }
702 709
703 - (void)animationDidEnd:(NSAnimation*)animation { 710 - (void)animationDidEnd:(NSAnimation*)animation {
704 [window_ close]; 711 [window_ close];
705 [animation_ setDelegate:nil]; 712 [animation_ setDelegate:nil];
706 [self release]; 713 [self release];
707 } 714 }
708 715
709 @end 716 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698