| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 NSView* contentView = [[self window] contentView]; | 242 NSView* contentView = [[self window] contentView]; |
| 243 [contentView addSubview:[findBarCocoaController view]]; | 243 [contentView addSubview:[findBarCocoaController view]]; |
| 244 | 244 |
| 245 CGFloat maxY = NSMaxY([contentView frame]); | 245 CGFloat maxY = NSMaxY([contentView frame]); |
| 246 CGFloat maxWidth = NSWidth([contentView frame]); | 246 CGFloat maxWidth = NSWidth([contentView frame]); |
| 247 [findBarCocoaController positionFindBarViewAtMaxY:maxY maxWidth:maxWidth]; | 247 [findBarCocoaController positionFindBarViewAtMaxY:maxY maxWidth:maxWidth]; |
| 248 } | 248 } |
| 249 | 249 |
| 250 - (void)tabInserted:(TabContents*)contents { | 250 - (void)tabInserted:(TabContents*)contents { |
| 251 [contentsController_ changeTabContents:contents]; | 251 [contentsController_ changeTabContents:contents]; |
| 252 DCHECK(![[contentsController_ view] isHidden]); |
| 252 } | 253 } |
| 253 | 254 |
| 254 - (void)tabDetached:(TabContents*)contents { | 255 - (void)tabDetached:(TabContents*)contents { |
| 255 DCHECK(contents == [contentsController_ tabContents]); | 256 DCHECK(contents == [contentsController_ tabContents]); |
| 256 [contentsController_ changeTabContents:NULL]; | 257 [contentsController_ changeTabContents:NULL]; |
| 258 [[contentsController_ view] setHidden:YES]; |
| 257 } | 259 } |
| 258 | 260 |
| 259 - (PanelTitlebarViewCocoa*)titlebarView { | 261 - (PanelTitlebarViewCocoa*)titlebarView { |
| 260 return titlebar_view_; | 262 return titlebar_view_; |
| 261 } | 263 } |
| 262 | 264 |
| 263 // Called to validate menu and toolbar items when this window is key. All the | 265 // Called to validate menu and toolbar items when this window is key. All the |
| 264 // items we care about have been set with the |-commandDispatch:| or | 266 // items we care about have been set with the |-commandDispatch:| or |
| 265 // |-commandDispatchUsingKeyModifiers:| actions and a target of FirstResponder | 267 // |-commandDispatchUsingKeyModifiers:| actions and a target of FirstResponder |
| 266 // in IB. If it's not one of those, let it continue up the responder chain to be | 268 // in IB. If it's not one of those, let it continue up the responder chain to be |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 - (BOOL)canBecomeKeyWindow { | 569 - (BOOL)canBecomeKeyWindow { |
| 568 // Panel can only gain focus if it is expanded. Minimized panels do not | 570 // Panel can only gain focus if it is expanded. Minimized panels do not |
| 569 // participate in Cmd-~ rotation. | 571 // participate in Cmd-~ rotation. |
| 570 // TODO(dimich): If it will be ever desired to expand/focus the Panel on | 572 // TODO(dimich): If it will be ever desired to expand/focus the Panel on |
| 571 // keyboard navigation or via main menu, the care should be taken to avoid | 573 // keyboard navigation or via main menu, the care should be taken to avoid |
| 572 // cases when minimized Panel is getting keyboard input, invisibly. | 574 // cases when minimized Panel is getting keyboard input, invisibly. |
| 573 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; | 575 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; |
| 574 } | 576 } |
| 575 | 577 |
| 576 @end | 578 @end |
| OLD | NEW |