OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 [window() setFrame:cocoa_bounds display:YES]; | 147 [window() setFrame:cocoa_bounds display:YES]; |
148 } | 148 } |
149 | 149 |
150 // Callers assume that this doesn't immediately delete the Browser object. | 150 // Callers assume that this doesn't immediately delete the Browser object. |
151 // The controller implementing the window delegate methods called from | 151 // The controller implementing the window delegate methods called from |
152 // |-performClose:| must take precautions to ensure that. | 152 // |-performClose:| must take precautions to ensure that. |
153 void BrowserWindowCocoa::Close() { | 153 void BrowserWindowCocoa::Close() { |
154 // If there is an overlay window, we contain a tab being dragged between | 154 // If there is an overlay window, we contain a tab being dragged between |
155 // windows. Don't hide the window as it makes the UI extra confused. We can | 155 // windows. Don't hide the window as it makes the UI extra confused. We can |
156 // still close the window, as that will happen when the drag completes. | 156 // still close the window, as that will happen when the drag completes. |
157 if ([controller_ overlayWindow]) | 157 if ([controller_ overlayWindow]) { |
158 [controller_ deferPerformClose]; | 158 [controller_ deferPerformClose]; |
159 else | 159 } else { |
| 160 // Make sure we hide the window immediately. Even though performClose: |
| 161 // calls orderOut: eventually, it leaves the window on-screen long enough |
| 162 // that we start to see tabs shutting down. http://crbug.com/23959 |
| 163 // TODO(viettrungluu): This is kind of bad, since |-performClose:| calls |
| 164 // |-windowShouldClose:| (on its delegate, which is probably the |
| 165 // controller) which may return |NO| causing the window to not be closed, |
| 166 // thereby leaving a hidden window. In fact, our window-closing procedure |
| 167 // involves a (indirect) recursion on |-performClose:|, which is also bad. |
| 168 [window() orderOut:controller_]; |
160 [window() performClose:controller_]; | 169 [window() performClose:controller_]; |
| 170 } |
161 } | 171 } |
162 | 172 |
163 void BrowserWindowCocoa::Activate() { | 173 void BrowserWindowCocoa::Activate() { |
164 [controller_ activate]; | 174 [controller_ activate]; |
165 } | 175 } |
166 | 176 |
167 void BrowserWindowCocoa::Deactivate() { | 177 void BrowserWindowCocoa::Deactivate() { |
168 // TODO(jcivelli): http://crbug.com/51364 Implement me. | 178 // TODO(jcivelli): http://crbug.com/51364 Implement me. |
169 NOTIMPLEMENTED(); | 179 NOTIMPLEMENTED(); |
170 } | 180 } |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 AvatarMenuBubbleController* menu = | 637 AvatarMenuBubbleController* menu = |
628 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 638 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
629 anchoredAt:point]; | 639 anchoredAt:point]; |
630 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; | 640 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; |
631 [menu showWindow:nil]; | 641 [menu showWindow:nil]; |
632 } | 642 } |
633 | 643 |
634 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { | 644 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { |
635 [[controller_ avatarButtonController] showAvatarBubble]; | 645 [[controller_ avatarButtonController] showAvatarBubble]; |
636 } | 646 } |
OLD | NEW |