| 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 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 5 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // Do not constrain the frame rect if our delegate says no. In this case, | 207 // Do not constrain the frame rect if our delegate says no. In this case, |
| 208 // return the original (unconstrained) frame. | 208 // return the original (unconstrained) frame. |
| 209 id delegate = [self delegate]; | 209 id delegate = [self delegate]; |
| 210 if ([delegate respondsToSelector:@selector(shouldConstrainFrameRect)] && | 210 if ([delegate respondsToSelector:@selector(shouldConstrainFrameRect)] && |
| 211 ![delegate shouldConstrainFrameRect]) | 211 ![delegate shouldConstrainFrameRect]) |
| 212 return frame; | 212 return frame; |
| 213 | 213 |
| 214 return [super constrainFrameRect:frame toScreen:screen]; | 214 return [super constrainFrameRect:frame toScreen:screen]; |
| 215 } | 215 } |
| 216 | 216 |
| 217 // This method is overridden in order to send the toggle fullscreen message | |
| 218 // through the cross-platform browser framework before going fullscreen. The | |
| 219 // message will eventually come back as a call to |-toggleSystemFullScreen|, | |
| 220 // which in turn calls AppKit's |NSWindow -toggleFullScreen:|. | |
| 221 - (void)toggleFullScreen:(id)sender { | |
| 222 id delegate = [self delegate]; | |
| 223 if ([delegate respondsToSelector:@selector(handleLionToggleFullscreen)]) | |
| 224 [delegate handleLionToggleFullscreen]; | |
| 225 } | |
| 226 | |
| 227 - (void)toggleSystemFullScreen { | |
| 228 if ([super respondsToSelector:@selector(toggleFullScreen:)]) | |
| 229 [super toggleFullScreen:nil]; | |
| 230 } | |
| 231 | |
| 232 - (NSPoint)fullScreenButtonOriginAdjustment { | 217 - (NSPoint)fullScreenButtonOriginAdjustment { |
| 233 if (!hasTabStrip_) | 218 if (!hasTabStrip_) |
| 234 return NSZeroPoint; | 219 return NSZeroPoint; |
| 235 | 220 |
| 236 // Vertically center the button. | 221 // Vertically center the button. |
| 237 NSPoint origin = NSMakePoint(0, -6); | 222 NSPoint origin = NSMakePoint(0, -6); |
| 238 | 223 |
| 239 // If there is a profile avatar icon present, shift the button over by its | 224 // If there is a profile avatar icon present, shift the button over by its |
| 240 // width and some padding. The new avatar button is displayed to the right | 225 // width and some padding. The new avatar button is displayed to the right |
| 241 // of the fullscreen icon, so it doesn't need to be shifted. | 226 // of the fullscreen icon, so it doesn't need to be shifted. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 [self childWindowsDidChange]; | 356 [self childWindowsDidChange]; |
| 372 } | 357 } |
| 373 | 358 |
| 374 - (void)childWindowsDidChange { | 359 - (void)childWindowsDidChange { |
| 375 id delegate = [self delegate]; | 360 id delegate = [self delegate]; |
| 376 if ([delegate respondsToSelector:@selector(childWindowsDidChange)]) | 361 if ([delegate respondsToSelector:@selector(childWindowsDidChange)]) |
| 377 [delegate childWindowsDidChange]; | 362 [delegate childWindowsDidChange]; |
| 378 } | 363 } |
| 379 | 364 |
| 380 @end | 365 @end |
| OLD | NEW |