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/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/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 452 |
453 - (void)awakeFromNib { | 453 - (void)awakeFromNib { |
454 NSWindow* window = [self window]; | 454 NSWindow* window = [self window]; |
455 | 455 |
456 DCHECK(window); | 456 DCHECK(window); |
457 DCHECK(titlebar_view_); | 457 DCHECK(titlebar_view_); |
458 DCHECK_EQ(self, [window delegate]); | 458 DCHECK_EQ(self, [window delegate]); |
459 | 459 |
460 [self updateWindowLevel]; | 460 [self updateWindowLevel]; |
461 | 461 |
462 if (base::mac::IsOSSnowLeopardOrLater()) { | 462 [window setCollectionBehavior:NSWindowCollectionBehaviorParticipatesInCycle]; |
463 [window setCollectionBehavior: | |
464 NSWindowCollectionBehaviorParticipatesInCycle]; | |
465 } | |
466 | 463 |
467 [titlebar_view_ attach]; | 464 [titlebar_view_ attach]; |
468 | 465 |
469 // Set initial size of the window to match the size of the panel to give | 466 // Set initial size of the window to match the size of the panel to give |
470 // the renderer the proper size to work with earlier, avoiding a resize | 467 // the renderer the proper size to work with earlier, avoiding a resize |
471 // after the window is revealed. | 468 // after the window is revealed. |
472 gfx::Rect panelBounds = windowShim_->panel()->GetBounds(); | 469 gfx::Rect panelBounds = windowShim_->panel()->GetBounds(); |
473 NSRect frame = [window frame]; | 470 NSRect frame = [window frame]; |
474 frame.size.width = panelBounds.width(); | 471 frame.size.width = panelBounds.width(); |
475 frame.size.height = panelBounds.height(); | 472 frame.size.height = panelBounds.height(); |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 1032 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
1036 NSRect contentRect = [[[self window] contentView] convertRect:frameRect | 1033 NSRect contentRect = [[[self window] contentView] convertRect:frameRect |
1037 fromView:nil]; | 1034 fromView:nil]; |
1038 contentRect.size.height -= panel::kTitlebarHeight; | 1035 contentRect.size.height -= panel::kTitlebarHeight; |
1039 if (contentRect.size.height < 0) | 1036 if (contentRect.size.height < 0) |
1040 contentRect.size.height = 0; | 1037 contentRect.size.height = 0; |
1041 return contentRect; | 1038 return contentRect; |
1042 } | 1039 } |
1043 | 1040 |
1044 @end | 1041 @end |
OLD | NEW |