Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/panels/panel_window_controller_cocoa.h" | 5 #include "chrome/browser/ui/panels/panel_window_controller_cocoa.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 NSView* contentView = [window contentView]; | 181 NSView* contentView = [window contentView]; |
| 182 [contentView setAutoresizesSubviews:NO]; | 182 [contentView setAutoresizesSubviews:NO]; |
| 183 | 183 |
| 184 // We grow the window from the bottom up to produce a 'reveal' animation. | 184 // We grow the window from the bottom up to produce a 'reveal' animation. |
| 185 NSRect startFrame = NSMakeRect(NSMinX(frame), NSMinY(frame), | 185 NSRect startFrame = NSMakeRect(NSMinX(frame), NSMinY(frame), |
| 186 NSWidth(frame), kMinimumWindowSize); | 186 NSWidth(frame), kMinimumWindowSize); |
| 187 [window setFrame:startFrame display:NO animate:NO]; | 187 [window setFrame:startFrame display:NO animate:NO]; |
| 188 // Shows the window without making it key, on top of its layer, even if | 188 // Shows the window without making it key, on top of its layer, even if |
| 189 // Chromium is not an active app. | 189 // Chromium is not an active app. |
| 190 [window orderFrontRegardless]; | 190 [window orderFrontRegardless]; |
| 191 // TODO(dcheng): Temporary hack to work around the fact that | |
| 192 // orderFrontRegardless causes us to become the first responder. The usual | |
| 193 // Chrome assumption is that becoming the first responder = you have focus, so | |
| 194 // we always deactivate the controls here. If we're created as an active | |
|
Dmitry Titov
2011/10/26 22:26:31
Not clear... Window gets orderFrontRegardless -> w
| |
| 195 // panel, we'll get a NSWindowDidBecomeKeynotification and reactivate the web | |
|
Dmitry Titov
2011/10/26 22:26:31
NSWindowDidBecomeKeynotification - need space
| |
| 196 // view properly. See crbug.com/97831 for more details. | |
| 197 TabContents* tab_contents = | |
| 198 windowShim_->panel()->browser()->GetSelectedTabContents(); | |
| 199 if (tab_contents) | |
| 200 tab_contents->GetRenderWidgetHostView()->SetActive(false); | |
| 191 [window setFrame:frame display:YES animate:YES]; | 201 [window setFrame:frame display:YES animate:YES]; |
| 192 | 202 |
| 193 [contentView setAutoresizesSubviews:YES]; | 203 [contentView setAutoresizesSubviews:YES]; |
| 194 } | 204 } |
| 195 | 205 |
| 196 - (void)updateTitleBar { | 206 - (void)updateTitleBar { |
| 197 NSString* newTitle = base::SysUTF16ToNSString( | 207 NSString* newTitle = base::SysUTF16ToNSString( |
| 198 windowShim_->browser()->GetWindowTitleForCurrentTab()); | 208 windowShim_->browser()->GetWindowTitleForCurrentTab()); |
| 199 pendingWindowTitle_.reset( | 209 pendingWindowTitle_.reset( |
| 200 [BrowserWindowUtils scheduleReplaceOldTitle:pendingWindowTitle_.get() | 210 [BrowserWindowUtils scheduleReplaceOldTitle:pendingWindowTitle_.get() |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 - (BOOL)canBecomeKeyWindow { | 562 - (BOOL)canBecomeKeyWindow { |
| 553 // Panel can only gain focus if it is expanded. Minimized panels do not | 563 // Panel can only gain focus if it is expanded. Minimized panels do not |
| 554 // participate in Cmd-~ rotation. | 564 // participate in Cmd-~ rotation. |
| 555 // TODO(dimich): If it will be ever desired to expand/focus the Panel on | 565 // TODO(dimich): If it will be ever desired to expand/focus the Panel on |
| 556 // keyboard navigation or via main menu, the care should be taken to avoid | 566 // keyboard navigation or via main menu, the care should be taken to avoid |
| 557 // cases when minimized Panel is getting keyboard input, invisibly. | 567 // cases when minimized Panel is getting keyboard input, invisibly. |
| 558 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; | 568 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; |
| 559 } | 569 } |
| 560 | 570 |
| 561 @end | 571 @end |
| OLD | NEW |