| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = |
| 153 [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater | 153 [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater |
| 154 styleMask:NSBorderlessWindowMask | 154 styleMask:NSBorderlessWindowMask |
| 155 backing:NSBackingStoreBuffered | 155 backing:NSBackingStoreBuffered |
| 156 defer:YES]; | 156 defer:NO]; |
| 157 [window setContentView:self]; | 157 [window setContentView:self]; |
| 158 | 158 |
| 159 // Telling Cocoa that the window is opaque enables some drawing optimizations. | 159 // Telling Cocoa that the window is opaque enables some drawing optimizations. |
| 160 [window setOpaque:YES]; | 160 [window setOpaque:YES]; |
| 161 | 161 |
| 162 [self updateBoundsAndRedrawPopup]; | 162 [self updateBoundsAndRedrawPopup]; |
| 163 [[delegate_->container_view() window] addChildWindow:window | 163 [[delegate_->container_view() window] addChildWindow:window |
| 164 ordered:NSWindowAbove]; | 164 ordered:NSWindowAbove]; |
| 165 } | 165 } |
| 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 |