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 #import "ui/views/cocoa/views_nswindow_delegate.h" | 5 #import "ui/views/cocoa/views_nswindow_delegate.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "ui/views/cocoa/bridged_content_view.h" | 8 #import "ui/views/cocoa/bridged_content_view.h" |
9 #import "ui/views/cocoa/bridged_native_widget.h" | 9 #import "ui/views/cocoa/bridged_native_widget.h" |
10 #include "ui/views/widget/native_widget_mac.h" | 10 #include "ui/views/widget/native_widget_mac.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 } | 28 } |
29 | 29 |
30 - (void)setCursor:(NSCursor*)newCursor { | 30 - (void)setCursor:(NSCursor*)newCursor { |
31 if (cursor_.get() == newCursor) | 31 if (cursor_.get() == newCursor) |
32 return; | 32 return; |
33 | 33 |
34 cursor_.reset([newCursor retain]); | 34 cursor_.reset([newCursor retain]); |
35 [parent_->ns_window() resetCursorRects]; | 35 [parent_->ns_window() resetCursorRects]; |
36 } | 36 } |
37 | 37 |
38 - (void)onWindowOrderWillChange:(NSWindowOrderingMode)orderingMode { | |
39 parent_->OnVisibilityChangedTo(orderingMode != NSWindowOut); | |
40 } | |
41 | |
42 - (void)onWindowOrderChanged:(NSNotification*)notification { | 38 - (void)onWindowOrderChanged:(NSNotification*)notification { |
43 parent_->OnVisibilityChanged(); | 39 parent_->OnVisibilityChanged(); |
44 } | 40 } |
45 | 41 |
46 - (void)onWindowWillDisplay { | |
47 parent_->OnVisibilityChangedTo(true); | |
48 } | |
49 | |
50 - (void)sheetDidEnd:(NSWindow*)sheet | 42 - (void)sheetDidEnd:(NSWindow*)sheet |
51 returnCode:(NSInteger)returnCode | 43 returnCode:(NSInteger)returnCode |
52 contextInfo:(void*)contextInfo { | 44 contextInfo:(void*)contextInfo { |
53 [sheet orderOut:nil]; | 45 [sheet orderOut:nil]; |
54 parent_->OnWindowWillClose(); | 46 parent_->OnWindowWillClose(); |
55 } | 47 } |
56 | 48 |
57 - (BOOL)shouldRepostPendingLeftMouseDown:(NSPoint)locationInWindow { | 49 - (BOOL)shouldRepostPendingLeftMouseDown:(NSPoint)locationInWindow { |
58 return parent_->ShouldRepostPendingLeftMouseDown(locationInWindow); | 50 return parent_->ShouldRepostPendingLeftMouseDown(locationInWindow); |
59 } | 51 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 usingRect:(NSRect)defaultSheetLocation { | 128 usingRect:(NSRect)defaultSheetLocation { |
137 // As per NSWindowDelegate documentation, the origin indicates the top left | 129 // As per NSWindowDelegate documentation, the origin indicates the top left |
138 // point of the host frame in window coordinates. The width changes the | 130 // point of the host frame in window coordinates. The width changes the |
139 // animation from vertical to trapezoid if it is smaller than the width of the | 131 // animation from vertical to trapezoid if it is smaller than the width of the |
140 // dialog. The height is ignored but should be set to zero. | 132 // dialog. The height is ignored but should be set to zero. |
141 return NSMakeRect(0, [self nativeWidgetMac]->SheetPositionY(), | 133 return NSMakeRect(0, [self nativeWidgetMac]->SheetPositionY(), |
142 NSWidth(defaultSheetLocation), 0); | 134 NSWidth(defaultSheetLocation), 0); |
143 } | 135 } |
144 | 136 |
145 @end | 137 @end |
OLD | NEW |