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

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

Issue 1315043003: [MacViews] Position modal sheets using ModalDialogHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bbobserver
Patch Set: Missded a comment nit. Created 5 years, 3 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 | « ui/views/widget/native_widget_mac.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 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // is still a valid pointer, then reset it. 98 // is still a valid pointer, then reset it.
99 if (bridge_) { 99 if (bridge_) {
100 delegate_->OnNativeWidgetDestroying(); 100 delegate_->OnNativeWidgetDestroying();
101 bridge_.reset(); 101 bridge_.reset();
102 } 102 }
103 delegate_->OnNativeWidgetDestroyed(); 103 delegate_->OnNativeWidgetDestroyed();
104 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) 104 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
105 delete this; 105 delete this;
106 } 106 }
107 107
108 int NativeWidgetMac::SheetPositionY() {
109 NSView* view = GetNativeView();
110 return
111 [view convertPoint:NSMakePoint(0, NSHeight([view frame])) toView:nil].y;
112 }
113
108 //////////////////////////////////////////////////////////////////////////////// 114 ////////////////////////////////////////////////////////////////////////////////
109 // NativeWidgetMac, internal::NativeWidgetPrivate implementation: 115 // NativeWidgetMac, internal::NativeWidgetPrivate implementation:
110 116
111 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) { 117 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) {
112 ownership_ = params.ownership; 118 ownership_ = params.ownership;
113 base::scoped_nsobject<NSWindow> window([CreateNSWindow(params) retain]); 119 base::scoped_nsobject<NSWindow> window([CreateNSWindow(params) retain]);
114 [window setReleasedWhenClosed:NO]; // Owned by scoped_nsobject. 120 [window setReleasedWhenClosed:NO]; // Owned by scoped_nsobject.
115 bridge_->Init(window, params); 121 bridge_->Init(window, params);
116 122
117 // Only set always-on-top here if it is true since setting it may affect how 123 // Only set always-on-top here if it is true since setting it may affect how
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window]; 712 [[ViewsNSWindowCloseAnimator alloc] initWithWindow:window];
707 } 713 }
708 714
709 - (void)animationDidEnd:(NSAnimation*)animation { 715 - (void)animationDidEnd:(NSAnimation*)animation {
710 [window_ close]; 716 [window_ close];
711 [animation_ setDelegate:nil]; 717 [animation_ setDelegate:nil];
712 [self release]; 718 [self release];
713 } 719 }
714 720
715 @end 721 @end
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698