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/presentation_mode_controller.h" | 5 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #import "base/mac/mac_util.h" | 10 #import "base/mac/mac_util.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 contentView_ = contentView; | 193 contentView_ = contentView; |
194 [self changeFloatingBarShownFraction:(showDropdown ? 1 : 0)]; | 194 [self changeFloatingBarShownFraction:(showDropdown ? 1 : 0)]; |
195 | 195 |
196 // Register for notifications. Self is removed as an observer in |-cleanup|. | 196 // Register for notifications. Self is removed as an observer in |-cleanup|. |
197 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; | 197 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; |
198 NSWindow* window = [browserController_ window]; | 198 NSWindow* window = [browserController_ window]; |
199 | 199 |
200 // Disable these notifications on Lion as they cause crashes. | 200 // Disable these notifications on Lion as they cause crashes. |
201 // TODO(rohitrao): Figure out what happens if a fullscreen window changes | 201 // TODO(rohitrao): Figure out what happens if a fullscreen window changes |
202 // monitors on Lion. | 202 // monitors on Lion. |
203 if (base::mac::IsOSSnowLeopardOrEarlier()) { | 203 if (base::mac::IsOSSnowLeopard()) { |
204 [nc addObserver:self | 204 [nc addObserver:self |
205 selector:@selector(windowDidChangeScreen:) | 205 selector:@selector(windowDidChangeScreen:) |
206 name:NSWindowDidChangeScreenNotification | 206 name:NSWindowDidChangeScreenNotification |
207 object:window]; | 207 object:window]; |
208 | 208 |
209 [nc addObserver:self | 209 [nc addObserver:self |
210 selector:@selector(windowDidMove:) | 210 selector:@selector(windowDidMove:) |
211 name:NSWindowDidMoveNotification | 211 name:NSWindowDidMoveNotification |
212 object:window]; | 212 object:window]; |
213 } | 213 } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 414 |
415 @implementation PresentationModeController (PrivateMethods) | 415 @implementation PresentationModeController (PrivateMethods) |
416 | 416 |
417 - (BOOL)isWindowOnPrimaryScreen { | 417 - (BOOL)isWindowOnPrimaryScreen { |
418 NSScreen* screen = [[browserController_ window] screen]; | 418 NSScreen* screen = [[browserController_ window] screen]; |
419 NSScreen* primaryScreen = [[NSScreen screens] objectAtIndex:0]; | 419 NSScreen* primaryScreen = [[NSScreen screens] objectAtIndex:0]; |
420 return (screen == primaryScreen); | 420 return (screen == primaryScreen); |
421 } | 421 } |
422 | 422 |
423 - (BOOL)shouldToggleMenuBar { | 423 - (BOOL)shouldToggleMenuBar { |
424 return base::mac::IsOSSnowLeopardOrEarlier() && | 424 return base::mac::IsOSSnowLeopard() && |
425 [self isWindowOnPrimaryScreen] && | 425 [self isWindowOnPrimaryScreen] && |
426 [[browserController_ window] isMainWindow]; | 426 [[browserController_ window] isMainWindow]; |
427 } | 427 } |
428 | 428 |
429 - (base::mac::FullScreenMode)desiredSystemFullscreenMode { | 429 - (base::mac::FullScreenMode)desiredSystemFullscreenMode { |
430 if ([browserController_ floatingBarShownFraction] >= 1.0) | 430 if ([browserController_ floatingBarShownFraction] >= 1.0) |
431 return base::mac::kFullScreenModeHideDock; | 431 return base::mac::kFullScreenModeHideDock; |
432 return base::mac::kFullScreenModeHideAll; | 432 return base::mac::kFullScreenModeHideAll; |
433 } | 433 } |
434 | 434 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 - (void)hideActiveWindowUI { | 645 - (void)hideActiveWindowUI { |
646 if (systemFullscreenMode_ != base::mac::kFullScreenModeNormal) { | 646 if (systemFullscreenMode_ != base::mac::kFullScreenModeNormal) { |
647 base::mac::ReleaseFullScreen(systemFullscreenMode_); | 647 base::mac::ReleaseFullScreen(systemFullscreenMode_); |
648 systemFullscreenMode_ = base::mac::kFullScreenModeNormal; | 648 systemFullscreenMode_ = base::mac::kFullScreenModeNormal; |
649 } | 649 } |
650 | 650 |
651 // TODO(rohitrao): Remove the Exit Fullscreen button. http://crbug.com/35956 | 651 // TODO(rohitrao): Remove the Exit Fullscreen button. http://crbug.com/35956 |
652 } | 652 } |
653 | 653 |
654 @end | 654 @end |
OLD | NEW |