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 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" | 5 #import "chrome/browser/ui/panels/panel_titlebar_view_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 #import "chrome/browser/ui/cocoa/tracking_area.h" | 10 #import "chrome/browser/ui/cocoa/tracking_area.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // contentView titlebar | 70 // contentView titlebar |
71 NSRect rootViewBounds = [[self superview] bounds]; | 71 NSRect rootViewBounds = [[self superview] bounds]; |
72 NSRect contentFrame = [[[controller_ window] contentView] frame]; | 72 NSRect contentFrame = [[[controller_ window] contentView] frame]; |
73 NSRect titlebarFrame = | 73 NSRect titlebarFrame = |
74 NSMakeRect(NSMinX(contentFrame), | 74 NSMakeRect(NSMinX(contentFrame), |
75 NSMaxY(contentFrame), | 75 NSMaxY(contentFrame), |
76 NSWidth(contentFrame), | 76 NSWidth(contentFrame), |
77 NSMaxY(rootViewBounds) - NSMaxY(contentFrame)); | 77 NSMaxY(rootViewBounds) - NSMaxY(contentFrame)); |
78 [self setFrame:titlebarFrame]; | 78 [self setFrame:titlebarFrame]; |
79 | 79 |
80 // Update layout of controls in the title bar. | 80 // Update layout of controls in the titlebar. |
81 [self updateCloseButtonLayout]; | 81 [self updateCloseButtonLayout]; |
82 | 82 |
83 // Set autoresizing behavior: glued to edges on left, top and right. | 83 // Set autoresizing behavior: glued to edges on left, top and right. |
84 [self setAutoresizingMask:(NSViewMinYMargin | NSViewWidthSizable)]; | 84 [self setAutoresizingMask:(NSViewMinYMargin | NSViewWidthSizable)]; |
85 } | 85 } |
86 | 86 |
87 - (void)updateCloseButtonLayout { | 87 - (void)updateCloseButtonLayout { |
88 NSRect buttonBounds = [closeButton_ bounds]; | 88 NSRect buttonBounds = [closeButton_ bounds]; |
89 NSRect bounds = [self bounds]; | 89 NSRect bounds = [self bounds]; |
90 | 90 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return controller_; | 125 return controller_; |
126 } | 126 } |
127 | 127 |
128 // (Private/TestingAPI) | 128 // (Private/TestingAPI) |
129 - (void)simulateCloseButtonClick { | 129 - (void)simulateCloseButtonClick { |
130 [[closeButton_ cell] performClick:closeButton_]; | 130 [[closeButton_ cell] performClick:closeButton_]; |
131 } | 131 } |
132 | 132 |
133 @end | 133 @end |
134 | 134 |
OLD | NEW |