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/cocoa/framed_browser_window.h" | 5 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
9 #import "chrome/browser/ui/cocoa/browser_frame_view.h" | 9 #import "chrome/browser/ui/cocoa/browser_frame_view.h" |
10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
11 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 11 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
12 #import "chrome/browser/ui/cocoa/themed_window.h" | 12 #import "chrome/browser/ui/cocoa/themed_window.h" |
13 #import "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 13 #import "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
14 #include "chrome/browser/themes/theme_service.h" | 14 #include "chrome/browser/themes/theme_service.h" |
15 | 15 |
16 // Provide the forward-declarations of new 10.7 SDK symbols so they can be | |
17 // called when building with the 10.5 SDK. | |
18 #if !defined(MAC_OS_X_VERSION_10_7) || \ | |
19 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | |
20 | |
21 @interface NSWindow (LionSDKDeclarations) | |
22 - (void)toggleFullScreen:(id)sender; | |
23 @end | |
24 | |
25 #endif // MAC_OS_X_VERSION_10_7 | |
26 | |
27 | |
16 // Implementer's note: Moving the window controls is tricky. When altering the | 28 // Implementer's note: Moving the window controls is tricky. When altering the |
17 // code, ensure that: | 29 // code, ensure that: |
18 // - accessibility hit testing works | 30 // - accessibility hit testing works |
19 // - the accessibility hierarchy is correct | 31 // - the accessibility hierarchy is correct |
20 // - close/min in the background don't bring the window forward | 32 // - close/min in the background don't bring the window forward |
21 // - rollover effects work correctly | 33 // - rollover effects work correctly |
22 | 34 |
23 namespace { | 35 namespace { |
24 | 36 |
25 // Size of the gradient. Empirically determined so that the gradient looks | 37 // Size of the gradient. Empirically determined so that the gradient looks |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 // Do not constrain the frame rect if our delegate says no. In this case, | 278 // Do not constrain the frame rect if our delegate says no. In this case, |
267 // return the original (unconstrained) frame. | 279 // return the original (unconstrained) frame. |
268 id delegate = [self delegate]; | 280 id delegate = [self delegate]; |
269 if ([delegate respondsToSelector:@selector(shouldConstrainFrameRect)] && | 281 if ([delegate respondsToSelector:@selector(shouldConstrainFrameRect)] && |
270 ![delegate shouldConstrainFrameRect]) | 282 ![delegate shouldConstrainFrameRect]) |
271 return frame; | 283 return frame; |
272 | 284 |
273 return [super constrainFrameRect:frame toScreen:screen]; | 285 return [super constrainFrameRect:frame toScreen:screen]; |
274 } | 286 } |
275 | 287 |
288 // This method is overridden in order to send the toggle fullscreen message | |
289 // through the cross-platform browser framework before going fullscreen. The | |
290 // message will eventually come back as a call to |-toggleSystemFullScreen|, | |
291 // which in turn calls AppKit's |NSWindow -toggleFullScreen:|. | |
292 - (void)toggleFullScreen:(id)sender { | |
293 id delegate = [self delegate]; | |
294 if ([delegate respondsToSelector:@selector(handleLionToggleFullscreen)]) | |
295 [delegate handleLionToggleFullscreen]; | |
Mark Mentovai
2011/08/04 19:18:17
Is there a decent way to preserve |sender| through
rohitrao (ping after 24h)
2011/08/04 19:49:17
Saving it on the stack looks like the most straigh
| |
296 } | |
297 | |
298 - (void)toggleSystemFullScreen { | |
299 if ([super respondsToSelector:@selector(toggleFullScreen:)]) | |
300 [super toggleFullScreen:nil]; | |
301 } | |
302 | |
276 @end | 303 @end |
OLD | NEW |