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 "chrome/browser/ui/cocoa/autofill/autofill_popup_base_view_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_popup_base_view_cocoa.h" |
6 | 6 |
7 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" | 7 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" |
8 #include "chrome/browser/ui/autofill/popup_constants.h" | 8 #include "chrome/browser/ui/autofill/popup_constants.h" |
9 #include "ui/base/cocoa/window_size_constants.h" | 9 #include "ui/base/cocoa/window_size_constants.h" |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 #pragma mark - | 132 #pragma mark - |
133 #pragma mark Messages from AutofillPopupViewBridge: | 133 #pragma mark Messages from AutofillPopupViewBridge: |
134 | 134 |
135 - (void)updateBoundsAndRedrawPopup { | 135 - (void)updateBoundsAndRedrawPopup { |
136 NSRect frame = NSRectFromCGRect(delegate_->popup_bounds().ToCGRect()); | 136 NSRect frame = NSRectFromCGRect(delegate_->popup_bounds().ToCGRect()); |
137 | 137 |
138 // Flip coordinates back into Cocoa-land. The controller's platform-neutral | 138 // Flip coordinates back into Cocoa-land. The controller's platform-neutral |
139 // coordinate space places the origin at the top-left of the first screen, | 139 // coordinate space places the origin at the top-left of the first screen, |
140 // whereas Cocoa's coordinate space expects the origin to be at the | 140 // whereas Cocoa's coordinate space expects the origin to be at the |
141 // bottom-left of this same screen. | 141 // bottom-left of this same screen. |
142 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 142 NSScreen* screen = [[NSScreen screens] firstObject]; |
143 frame.origin.y = NSMaxY([screen frame]) - NSMaxY(frame); | 143 frame.origin.y = NSMaxY([screen frame]) - NSMaxY(frame); |
144 | 144 |
145 // TODO(isherman): The view should support scrolling if the popup gets too | 145 // TODO(isherman): The view should support scrolling if the popup gets too |
146 // big to fit on the screen. | 146 // big to fit on the screen. |
147 [[self window] setFrame:frame display:YES]; | 147 [[self window] setFrame:frame display:YES]; |
148 [self setNeedsDisplay:YES]; | 148 [self setNeedsDisplay:YES]; |
149 } | 149 } |
150 | 150 |
151 - (void)showPopup { | 151 - (void)showPopup { |
152 NSWindow* window = | 152 NSWindow* window = |
(...skipping 13 matching lines...) Expand all Loading... |
166 | 166 |
167 - (void)hidePopup { | 167 - (void)hidePopup { |
168 // Remove the child window before closing, otherwise it can mess up | 168 // Remove the child window before closing, otherwise it can mess up |
169 // display ordering. | 169 // display ordering. |
170 NSWindow* window = [self window]; | 170 NSWindow* window = [self window]; |
171 [[window parentWindow] removeChildWindow:window]; | 171 [[window parentWindow] removeChildWindow:window]; |
172 [window close]; | 172 [window close]; |
173 } | 173 } |
174 | 174 |
175 @end | 175 @end |
OLD | NEW |