Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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. (e.g. with NSBorderlessWindowMask. the parent | |
|
tapted
2015/08/20 00:23:09
nit (sorry - I gave you bad text :p): Grammar peda
jackhou1
2015/08/20 00:37:16
Done. (Sorry I should have checked it).
| |
| 43 // 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 Loading... | |
| 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 |
| OLD | NEW |