| 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/browser_window_controller_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #import "base/memory/scoped_nsobject.h" | 8 #import "base/memory/scoped_nsobject.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 23 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 24 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | 24 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
| 25 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 25 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 27 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "content/browser/renderer_host/render_widget_host_view.h" | 29 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 30 #include "content/browser/tab_contents/tab_contents.h" | 30 #include "content/browser/tab_contents/tab_contents.h" |
| 31 #include "content/browser/tab_contents/tab_contents_view.h" | 31 #include "content/browser/tab_contents/tab_contents_view.h" |
| 32 | 32 |
| 33 // Provide the forward-declarations of new 10.7 SDK symbols so they can be |
| 34 // called when building with the 10.5 SDK. |
| 35 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
| 36 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
| 37 |
| 38 @interface NSWindow (LionSDKDeclarations) |
| 39 - (void)toggleFullScreen:(id)sender; |
| 40 @end |
| 41 |
| 42 enum { |
| 43 NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7, |
| 44 NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8 |
| 45 }; |
| 46 |
| 47 enum { |
| 48 NSWindowFullScreenButton = 7 |
| 49 }; |
| 50 |
| 51 #endif // MAC_OS_X_VERSION_10_7 |
| 52 |
| 33 namespace { | 53 namespace { |
| 34 | 54 |
| 35 // Space between the incognito badge and the right edge of the window. | 55 // Space between the incognito badge and the right edge of the window. |
| 36 const CGFloat kIncognitoBadgeOffset = 4; | 56 const CGFloat kIncognitoBadgeOffset = 4; |
| 37 | 57 |
| 38 // Insets for the location bar, used when the full toolbar is hidden. | 58 // Insets for the location bar, used when the full toolbar is hidden. |
| 39 // TODO(viettrungluu): We can argue about the "correct" insetting; I like the | 59 // TODO(viettrungluu): We can argue about the "correct" insetting; I like the |
| 40 // following best, though arguably 0 inset is better/more correct. | 60 // following best, though arguably 0 inset is better/more correct. |
| 41 const CGFloat kLocBarLeftRightInset = 1; | 61 const CGFloat kLocBarLeftRightInset = 1; |
| 42 const CGFloat kLocBarTopInset = 0; | 62 const CGFloat kLocBarTopInset = 0; |
| 43 const CGFloat kLocBarBottomInset = 1; | 63 const CGFloat kLocBarBottomInset = 1; |
| 44 | 64 |
| 45 } // end namespace | 65 } // namespace |
| 46 | |
| 47 // 10.7 adds public APIs for full-screen support. Provide the declaration so it | |
| 48 // can be called below when building with the 10.5 SDK. | |
| 49 #if !defined(MAC_OS_X_VERSION_10_7) || \ | |
| 50 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | |
| 51 | |
| 52 @interface NSWindow (LionSDKDeclarations) | |
| 53 - (void)toggleFullScreen:(id)sender; | |
| 54 @end | |
| 55 | |
| 56 enum { | |
| 57 NSWindowFullScreenButton = 7 | |
| 58 }; | |
| 59 | |
| 60 #endif // MAC_OS_X_VERSION_10_7 | |
| 61 | 66 |
| 62 @implementation BrowserWindowController(Private) | 67 @implementation BrowserWindowController(Private) |
| 63 | 68 |
| 64 // Create the appropriate tab strip controller based on whether or not side | 69 // Create the appropriate tab strip controller based on whether or not side |
| 65 // tabs are enabled. | 70 // tabs are enabled. |
| 66 - (void)createTabStripController { | 71 - (void)createTabStripController { |
| 67 Class factory = [TabStripController class]; | 72 Class factory = [TabStripController class]; |
| 68 if ([self useVerticalTabs]) | 73 if ([self useVerticalTabs]) |
| 69 factory = [SideTabStripController class]; | 74 factory = [SideTabStripController class]; |
| 70 | 75 |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 536 |
| 532 - (void)disableBarVisibilityUpdates { | 537 - (void)disableBarVisibilityUpdates { |
| 533 // Early escape if there's nothing to do. | 538 // Early escape if there's nothing to do. |
| 534 if (!barVisibilityUpdatesEnabled_) | 539 if (!barVisibilityUpdatesEnabled_) |
| 535 return; | 540 return; |
| 536 | 541 |
| 537 barVisibilityUpdatesEnabled_ = NO; | 542 barVisibilityUpdatesEnabled_ = NO; |
| 538 [fullscreenController_ cancelAnimationAndTimers]; | 543 [fullscreenController_ cancelAnimationAndTimers]; |
| 539 } | 544 } |
| 540 | 545 |
| 546 - (void)setUpOSFullScreenButton { |
| 547 NSWindow* window = [self window]; |
| 548 if ([window respondsToSelector:@selector(toggleFullScreen:)]) { |
| 549 NSWindowCollectionBehavior behavior = [window collectionBehavior]; |
| 550 behavior |= NSWindowCollectionBehaviorFullScreenPrimary; |
| 551 [window setCollectionBehavior:behavior]; |
| 552 |
| 553 NSButton* fullscreenButton = |
| 554 [window standardWindowButton:NSWindowFullScreenButton]; |
| 555 [fullscreenButton setAction:@selector(enterFullscreen:)]; |
| 556 [fullscreenButton setTarget:self]; |
| 557 } |
| 558 } |
| 559 |
| 541 @end // @implementation BrowserWindowController(Private) | 560 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |