| 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/browser_window_controller_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #import "base/memory/scoped_nsobject.h" | 10 #import "base/memory/scoped_nsobject.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 24 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 25 #import "chrome/browser/ui/cocoa/fullscreen_window.h" | 25 #import "chrome/browser/ui/cocoa/fullscreen_window.h" |
| 26 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 26 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 27 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 27 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
| 28 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" | 28 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" |
| 29 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" | 29 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" |
| 30 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" | 30 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" |
| 31 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 31 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 32 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | 32 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
| 33 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 33 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 34 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 34 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 35 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 35 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
| 36 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
| 37 #include "content/public/browser/render_widget_host_view.h" | 38 #include "content/public/browser/render_widget_host_view.h" |
| 38 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
| 39 #include "content/public/browser/web_contents_view.h" | 40 #include "content/public/browser/web_contents_view.h" |
| 40 #import "ui/base/cocoa/focus_tracker.h" | 41 #import "ui/base/cocoa/focus_tracker.h" |
| 41 #include "ui/base/ui_base_types.h" | 42 #include "ui/base/ui_base_types.h" |
| 42 | 43 |
| 43 using content::RenderWidgetHostView; | 44 using content::RenderWidgetHostView; |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 // We're done moving focus, so re-enable bar visibility changes. | 629 // We're done moving focus, so re-enable bar visibility changes. |
| 629 [self enableBarVisibilityUpdates]; | 630 [self enableBarVisibilityUpdates]; |
| 630 } | 631 } |
| 631 | 632 |
| 632 - (void)setPresentationModeInternal:(BOOL)presentationMode | 633 - (void)setPresentationModeInternal:(BOOL)presentationMode |
| 633 forceDropdown:(BOOL)forceDropdown { | 634 forceDropdown:(BOOL)forceDropdown { |
| 634 if (presentationMode == [self inPresentationMode]) | 635 if (presentationMode == [self inPresentationMode]) |
| 635 return; | 636 return; |
| 636 | 637 |
| 637 if (presentationMode) { | 638 if (presentationMode) { |
| 638 BOOL fullscreen_for_tab = browser_->IsFullscreenForTabOrPending(); | 639 BOOL fullscreen_for_tab = |
| 640 browser_->fullscreen_controller()->IsFullscreenForTabOrPending(); |
| 639 BOOL kiosk_mode = | 641 BOOL kiosk_mode = |
| 640 CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); | 642 CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); |
| 641 BOOL showDropdown = !fullscreen_for_tab && | 643 BOOL showDropdown = !fullscreen_for_tab && |
| 642 !kiosk_mode && | 644 !kiosk_mode && |
| 643 (forceDropdown || [self floatingBarHasFocus]); | 645 (forceDropdown || [self floatingBarHasFocus]); |
| 644 NSView* contentView = [[self window] contentView]; | 646 NSView* contentView = [[self window] contentView]; |
| 645 presentationModeController_.reset( | 647 presentationModeController_.reset( |
| 646 [[PresentationModeController alloc] initWithBrowserController:self]); | 648 [[PresentationModeController alloc] initWithBrowserController:self]); |
| 647 [presentationModeController_ enterPresentationModeForContentView:contentView | 649 [presentationModeController_ enterPresentationModeForContentView:contentView |
| 648 showDropdown:showDropdown]; | 650 showDropdown:showDropdown]; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 NSApplicationPresentationAutoHideDock | | 816 NSApplicationPresentationAutoHideDock | |
| 815 NSApplicationPresentationAutoHideMenuBar); | 817 NSApplicationPresentationAutoHideMenuBar); |
| 816 } | 818 } |
| 817 | 819 |
| 818 - (void)windowWillEnterFullScreen:(NSNotification*)notification { | 820 - (void)windowWillEnterFullScreen:(NSNotification*)notification { |
| 819 [self registerForContentViewResizeNotifications]; | 821 [self registerForContentViewResizeNotifications]; |
| 820 | 822 |
| 821 NSWindow* window = [self window]; | 823 NSWindow* window = [self window]; |
| 822 savedRegularWindowFrame_ = [window frame]; | 824 savedRegularWindowFrame_ = [window frame]; |
| 823 BOOL mode = [self shouldUsePresentationModeWhenEnteringFullscreen]; | 825 BOOL mode = [self shouldUsePresentationModeWhenEnteringFullscreen]; |
| 824 mode = mode || browser_->IsFullscreenForTabOrPending(); | 826 mode = mode || |
| 827 browser_->fullscreen_controller()->IsFullscreenForTabOrPending(); |
| 825 enteringFullscreen_ = YES; | 828 enteringFullscreen_ = YES; |
| 826 [self setPresentationModeInternal:mode forceDropdown:NO]; | 829 [self setPresentationModeInternal:mode forceDropdown:NO]; |
| 827 } | 830 } |
| 828 | 831 |
| 829 - (void)windowDidEnterFullScreen:(NSNotification*)notification { | 832 - (void)windowDidEnterFullScreen:(NSNotification*)notification { |
| 830 if (base::mac::IsOSLionOrLater()) | 833 if (base::mac::IsOSLionOrLater()) |
| 831 [self deregisterForContentViewResizeNotifications]; | 834 [self deregisterForContentViewResizeNotifications]; |
| 832 enteringFullscreen_ = NO; | 835 enteringFullscreen_ = NO; |
| 833 [self showFullscreenExitBubbleIfNecessary]; | 836 [self showFullscreenExitBubbleIfNecessary]; |
| 834 browser_->WindowFullscreenStateChanged(); | 837 browser_->WindowFullscreenStateChanged(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 - (void)disableBarVisibilityUpdates { | 882 - (void)disableBarVisibilityUpdates { |
| 880 // Early escape if there's nothing to do. | 883 // Early escape if there's nothing to do. |
| 881 if (!barVisibilityUpdatesEnabled_) | 884 if (!barVisibilityUpdatesEnabled_) |
| 882 return; | 885 return; |
| 883 | 886 |
| 884 barVisibilityUpdatesEnabled_ = NO; | 887 barVisibilityUpdatesEnabled_ = NO; |
| 885 [presentationModeController_ cancelAnimationAndTimers]; | 888 [presentationModeController_ cancelAnimationAndTimers]; |
| 886 } | 889 } |
| 887 | 890 |
| 888 @end // @implementation BrowserWindowController(Private) | 891 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |